* @param parser
*/
private Dependency parseDependency(String tagName, XmlPullParser parser, boolean strict, String encoding)
throws IOException, XmlPullParserException
{
Dependency dependency = new Dependency();
dependency.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "id" ) )
{
if ( parsed.contains( "id" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "id" );
dependency.setId( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "groupId" ) )
{
if ( parsed.contains( "groupId" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "groupId" );
dependency.setGroupId( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "artifactId" ) )
{
if ( parsed.contains( "artifactId" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "artifactId" );
dependency.setArtifactId( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "version" ) )
{
if ( parsed.contains( "version" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "version" );
dependency.setVersion( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "url" ) )
{
if ( parsed.contains( "url" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "url" );
dependency.setUrl( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "jar" ) )
{
if ( parsed.contains( "jar" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "jar" );
dependency.setJar( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "type" ) )
{
if ( parsed.contains( "type" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "type" );
dependency.setType( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "properties" ) )
{
if ( parsed.contains( "properties" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "properties" );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
String value = parser.nextText()
.trim()
;
dependency.addProperty( key, value );
}
}
else
{
if ( strict )