@Override public void process(@Nonnull final XmlParser xmlParser, @Nonnull final Attributes attributes) throws Exception { String name = getNameAttribute(attributes); Type type = new Type(name, getExtendsAttribute(attributes)); niftyXmlSchema.addType(name, type); SubstitutionGroup substGroup = new SubstitutionGroup(); substGroup.add("element", new TypeProcessorElement(type)); substGroup.add("group", new TypeProcessorSubstitutionGroup(type)); xmlParser.nextTag(); xmlParser.zeroOrMore(substGroup); }
/** * SubstitionGroup Support. * * @param substGroup SubstitutionGroup * @throws Exception exception */ public void zeroOrMore(@Nonnull final SubstitutionGroup substGroup) throws Exception { if (isEndTag()) { return; } XmlProcessor element = substGroup.matches(xpp.getName()); if (element == null) { return; } processElement(element); nextTag(); zeroOrMore(substGroup); }
public void addToSubstGroup( @Nonnull final Schema schema, @Nonnull final SubstitutionGroup substitutionGroup, @Nonnull final XmlType xmlType) throws Exception { Type type = schema.getType(tagType); Type typeParent = type.getTypeParent(schema); if (typeParent != null) { XmlProcessorElement xmlProcessorElement = new XmlProcessorElement( typeParent.createXmlProcessorFromType(schema, type), tagName, occurs); substitutionGroup.add(getTagName(), new Helper(xmlType, xmlProcessorElement)); } else { XmlProcessorElement xmlProcessorElement = new XmlProcessorElement( type.createXmlProcessor(schema), tagName, occurs); substitutionGroup.add(getTagName(), new Helper(xmlType, xmlProcessorElement)); } }
@Override public void process(@Nonnull final XmlParser xmlParser, @Nonnull final Attributes attributes) throws Exception { packageString = attributes.get("package"); if (packageString == null) { throw new Exception("[package] attribute is a required attribute"); } root = attributes.get("root"); if (root == null) { throw new Exception("[root] attribute is a required attribute"); } type = attributes.get("type"); if (type == null) { throw new Exception("[type] attribute is a required attribute"); } xmlParser.nextTag(); xmlParser.zeroOrMore( new de.lessvoid.xml.xpp3.SubstitutionGroup() .add("include", new IncludeProcessor(parserFactory, resourceLoader, types)) .add("type", new TypeProcessor(this))); }