* @return Variable
*/
private Variable parseVariable(String tagName, XmlPullParser parser, boolean strict)
throws IOException, XmlPullParserException
{
Variable variable = new Variable();
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "name" ) )
{
if ( parsed.contains( "name" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null );
}
parsed.add( "name" );
variable.setName( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "description" ) )
{
if ( parsed.contains( "description" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null );
}
parsed.add( "description" );
variable.setDescription( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "defvalue" ) )
{
if ( parsed.contains( "defvalue" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null );
}
parsed.add( "defvalue" );
variable.setDefvalue( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "variables" ) )
{
if ( parsed.contains( "variables" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null );
}
parsed.add( "variables" );
java.util.List variables = new java.util.ArrayList();
variable.setVariables( variables );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "variable" ) )
{
variables.add( parseVariable( "variable", parser, strict ) );