* @param parser
*/
private Resource parseResource(String tagName, XmlPullParser parser, boolean strict, String encoding)
throws IOException, XmlPullParserException
{
Resource resource = new Resource();
resource.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "targetPath" ) )
{
if ( parsed.contains( "targetPath" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "targetPath" );
resource.setTargetPath( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "filtering" ) )
{
if ( parsed.contains( "filtering" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "filtering" );
resource.setFiltering( getBooleanValue( getTrimmedValue( parser.nextText()), "filtering", parser ) );
}
else if ( parser.getName().equals( "directory" ) )
{
if ( parsed.contains( "directory" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "directory" );
resource.setDirectory( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "includes" ) )
{
if ( parsed.contains( "includes" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "includes" );
java.util.List includes = new java.util.ArrayList();
resource.setIncludes( includes );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "include" ) )
{
includes.add( getTrimmedValue( parser.nextText()) );
}
else
{
parser.nextText();
}
}
}
else if ( parser.getName().equals( "excludes" ) )
{
if ( parsed.contains( "excludes" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "excludes" );
java.util.List excludes = new java.util.ArrayList();
resource.setExcludes( excludes );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "exclude" ) )
{
excludes.add( getTrimmedValue( parser.nextText()) );