* @return ProfilesRoot
*/
private ProfilesRoot parseProfilesRoot( String tagName, XmlPullParser parser, boolean strict )
throws IOException, XmlPullParserException
{
ProfilesRoot profilesRoot = new ProfilesRoot();
java.util.Set parsed = new java.util.HashSet();
int eventType = parser.getEventType();
boolean foundRoot = false;
profilesRoot.setModelEncoding( parser.getInputEncoding() );
while ( eventType != XmlPullParser.END_DOCUMENT )
{
if ( eventType == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( tagName ) )
{
foundRoot = true;
}
else if ( strict && ! foundRoot )
{
throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
}
else if ( checkFieldWithDuplicate( parser, "profiles", null, parsed ) )
{
java.util.List profiles = new java.util.ArrayList/*<Profile>*/();
profilesRoot.setProfiles( profiles );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "profile" ) )
{
profiles.add( parseProfile( "profile", parser, strict ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "activeProfiles", null, parsed ) )
{
java.util.List activeProfiles = new java.util.ArrayList/*<String>*/();
profilesRoot.setActiveProfiles( activeProfiles );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "activeProfile" ) )
{
activeProfiles.add( getTrimmedValue( parser.nextText() ) );