* @param xmlStreamReader
*/
private Resource parseResource(String tagName, XMLStreamReader xmlStreamReader, boolean strict, String encoding)
throws IOException, XMLStreamException
{
Resource resource = new Resource();
resource.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "targetPath" ) )
{
if ( parsed.contains( "targetPath" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "targetPath" );
resource.setTargetPath( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "filtering" ) )
{
if ( parsed.contains( "filtering" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "filtering" );
resource.setFiltering( getBooleanValue( getTrimmedValue( xmlStreamReader.getElementText()), "filtering", xmlStreamReader ) );
}
else if ( xmlStreamReader.getLocalName().equals( "directory" ) )
{
if ( parsed.contains( "directory" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "directory" );
resource.setDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "includes" ) )
{
if ( parsed.contains( "includes" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "includes" );
java.util.List includes = new java.util.ArrayList();
resource.setIncludes( includes );
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "include" ) )
{
includes.add( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else
{
throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
}
}
else if ( xmlStreamReader.getLocalName().equals( "excludes" ) )
{
if ( parsed.contains( "excludes" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "excludes" );
java.util.List excludes = new java.util.ArrayList();
resource.setExcludes( excludes );
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "exclude" ) )
{
excludes.add( getTrimmedValue( xmlStreamReader.getElementText()) );