Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-434

Compiler generates method for creating multiple root tags

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Version 2.5
    • Fix Version/s: None
    • Component/s: Compiler
    • Labels:
      None

      Description

      While playing around with XMLBeans API in focus of following XML:

      <?xml version="1.0"?>
      <po:integration-design-patterns xmlns:po="http://openuri.org/easypo">
      <po:integration-pattern>
      <po:pattern-name>MVC</po:pattern-name>
      <po:description>Separated business model, presentation layer & controller</po:description>
      <po:full-oop-support-required>true</po:full-oop-support-required>
      <po:implementation-dependencies>
      <po:pattern-name>Front Controller</po:pattern-name>
      </po:implementation-dependencies xmlns:po>
      <po:implemented-frameworks>
      <po:framework>
      <po:name>YII framework</po:name>
      <po:language>PHP 5</po:language>
      </po:framework>
      <po:framework>
      <po:name>Ruby On Rails</po:name>
      <po:language>Ruby</po:language>
      </po:framework>
      <po:framework>
      <po:name>DJango</po:name>
      <po:language>Python</po:language>
      </po:framework>
      <po:framework>
      <po:name>TurboGears</po:name>
      <po:language>Python</po:language>
      </po:framework>
      </po:implemented-frameworks>
      </po:integration-pattern>
      <po:integration-pattern>
      <po:pattern-name>Session></po:pattern-name>
      <po:description>Provide distributed client session</po:description>
      <po:full-oop-support-required>false</po:full-oop-support-required>
      </po:integration-pattern>
      </po:integration-design-patterns>

      And describing the data model in the following way:

      <xs:schema targetNamespace="http://openuri.org/easypo"
      xmlns:po="http://openuri.org/easypo"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified">
      <xs:element name="integration-design-patterns">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="integration-pattern" type="po:integration-pattern" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:complexType name="integration-pattern">
      <xs:sequence>
      <xs:element name="pattern-name" type="xs:string" />
      <xs:element name="description" type="xs:string" />
      <xs:element name="full-oop-support-required" type="xs:boolean" />
      <xs:element name="implementation-dependencies" type="po:implementation-dependencies" xmlns: minOccurs="0" maxOccurs="3"/>
      <xs:element name="implemented-frameworks" type="po:implemented-frameworks" minOccurs="0" maxOccurs="10"/>
      </xs:sequence>
      </xs:complexType>
      <xs:complexType name="implementation-dependencies">
      <xs:sequence>
      <xs:element name="pattern-name" type="xs:string" minOccurs="1"/>
      </xs:sequence>
      </xs:complexType>
      <xs:complexType name="implemented-frameworks">
      <xs:sequence>
      <xs:element name="framework" type="po:framework" minOccurs="1" maxOccurs="10"/>
      </xs:sequence>
      </xs:complexType>
      <xs:complexType name="framework">
      <xs:sequence>
      <xs:element name="name" minOccurs="1" maxOccurs="1" type="xs:string" />
      <xs:element name="language" minOccurs="1" maxOccurs="1" type="xs:string" />
      </xs:sequence>
      </xs:complexType>
      </xs:schema>

      The devasting thing is that there is a possibility to add more that one root tag, which itself is incompatible with w3c rules:

      import java.io.File;
      import org.openuri.easypo.IntegrationDesignPatternsDocument;
      import org.openuri.easypo.IntegrationPattern;
      import org.openuri.easypo.ImplementationDependencies;
      public class DesignPatternReference
      {
      public IntegrationDesignPatternsDocument generateDoc()

      { IntegrationDesignPatternsDocument entry = IntegrationDesignPatternsDocument.Factory.newInstance(); entry.addNewIntegrationDesignPatterns().addNewIntegrationPattern(); IntegrationPattern patternInstance = entry.getIntegrationDesignPatterns().addNewIntegrationPattern(); patternInstance.setPatternName("Facade"); patternInstance.setFullOopSupportRequired(true); return entry; }

      public static void describePatterns(File po) throws Exception
      {
      IntegrationDesignPatternsDocument reference = IntegrationDesignPatternsDocument.Factory.parse(po);
      IntegrationPattern[] integrationPatterns = reference.getIntegrationDesignPatterns().getIntegrationPatternArray();
      IntegrationPattern pattern = integrationPatterns[0];
      String patternName = pattern.getPatternName();
      ImplementationDependencies[] deps = pattern.getImplementationDependenciesArray();

      for (int i=0; i<deps.length; i++)

      { System.out.println(deps[i].getPatternName()); }

      //System.out.println("");
      //ImplementedFrameworks frameworks = pattern[0].getImplementedFrameworks();
      //Framework[] frameworks = frameworks.getFrameworkArray();
      }
      }

      Hence *.addNewIntegrationDesignPatterns();

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webautomator John
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: