[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Created: (XMLBEANS-434) Compiler generates method for
From:       "John (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2010-04-10 15:07:47
Message-ID: 25851206.1281270912067496.JavaMail.jira () thor
[Download RAW message or body]

Compiler generates method for creating multiple root tags
---------------------------------------------------------

                 Key: XMLBEANS-434
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-434
             Project: XMLBeans
          Issue Type: Bug
          Components: Compiler
    Affects Versions: Version 2.5
            Reporter: John


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 &amp; \
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();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: \
                https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic