*/
private Notifier parseNotifier( XmlPullParser parser, boolean strict, InputSource source )
throws IOException, XmlPullParserException
{
String tagName = parser.getName();
Notifier notifier = new Notifier();
InputLocation _location;
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "", _location );
for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
{
String name = parser.getAttributeName( i );
String value = parser.getAttributeValue( i );
if ( name.indexOf( ':' ) >= 0 )
{
// just ignore attributes with non-default namespace (for example: xmlns:xsi)
}
else
{
checkUnknownAttribute( parser, name, tagName, strict );
}
}
java.util.Set parsed = new java.util.HashSet();
while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
{
if ( checkFieldWithDuplicate( parser, "type", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "type", _location );
notifier.setType( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "sendOnError", _location );
notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnError", parser, "true" ) );
}
else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "sendOnFailure", _location );
notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnFailure", parser, "true" ) );
}
else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "sendOnSuccess", _location );
notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnSuccess", parser, "true" ) );
}
else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "sendOnWarning", _location );
notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnWarning", parser, "true" ) );
}
else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "address", _location );
notifier.setAddress( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
{
InputLocation _locations;
_locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
notifier.setLocation( "configuration", _locations );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
_locations.setLocation( key, _location );
String value = parser.nextText().trim();
notifier.addConfiguration( key, value );
}
}
else
{
checkUnknownElement( parser, strict );