Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore src/mdo/reader.vm #1034

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions src/mdo/reader.vm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import org.apache.maven.internal.xml.XmlNodeBuilder;
#foreach ( $class in $model.allClasses )
import ${packageModelV4}.${class.name};
#end
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
import org.codehaus.plexus.util.xml.pull.MXParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
Expand Down Expand Up @@ -564,11 +565,13 @@ public class ${className}
} //-- int nextTag( XmlPullParser )

/**
* @see ReaderFactory#newXmlReader
*
* @param reader a reader object
* @param strict a strict object
* @throws IOException IOException if any
* @throws XmlPullParserException XmlPullParserException if any
* @param reader a reader object.
* @param strict a strict object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
* any.
* @return ${root.name}
*/
public ${root.name} read( Reader reader, boolean strict )
Expand All @@ -578,14 +581,17 @@ public class ${className}

parser.setInput( reader );


return read( parser, strict );
} //-- ${root.name} read( Reader, boolean )

/**
* @see ReaderFactory#newXmlReader
*
* @param reader a reader object
* @param reader a reader object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if any
* @throws XmlPullParserException XmlPullParserException if
* any.
* @return ${root.name}
*/
public ${root.name} read( Reader reader )
Expand All @@ -597,43 +603,42 @@ public class ${className}
/**
* Method read.
*
* @param in a in object
* @param strict a strict object
* @throws IOException IOException if any
* @throws XmlPullParserException XmlPullParserException if any
* @param in a in object.
* @param strict a strict object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
* any.
* @return ${root.name}
*/
public ${root.name} read( InputStream in, boolean strict )
throws IOException, XmlPullParserException
{
XmlPullParser parser = addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser( );

parser.setInput( in, null );

return read( in, strict );
return read( ReaderFactory.newXmlReader( in ), strict );
} //-- ${root.name} read( InputStream, boolean )

/**
* Method read.
*
* @param in a in object
* @throws IOException IOException if any
* @throws XmlPullParserException XmlPullParserException if any
* @param in a in object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
* any.
* @return ${root.name}
*/
public ${root.name} read( InputStream in )
throws IOException, XmlPullParserException
{
return read( in, true );
return read( ReaderFactory.newXmlReader( in ) );
} //-- ${root.name} read( InputStream )

/**
* Method read.
*
* @param parser a parser object
* @param strict a strict object
* @throws IOException IOException if any
* @throws XmlPullParserException XmlPullParserException if any
* @param parser a parser object.
* @param strict a strict object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
* any.
* @return ${root.name}
*/
public ${root.name} read( XmlPullParser parser, boolean strict )
Expand Down