You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by Mike Morris <mo...@telcordia.com> on 2004/06/23 15:49:23 UTC
Scoping of Elements in an XSD Document
Consider the following XML schema abstract:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://automation.granite.com/service-request.xsd" targetNamespace="http://automation.granite.com/service-request">
<xs:element name="methodCall">
<xs:complexType>
<xs:sequence>
<xs:element name="methodName" type="xs:string"/>
<xs:element name="params" type="tns:ParamsType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
........................ (etc)
When I generate XMLBeans from from the above schema and load a bean with XML based on the schema I find that I cannot reference the values (get or set) in the 'methodName' or 'params' nodes. Is this a function of the nodes being defined within the complex type? Is this a bug? Is there a way to reference these (and their child) nodes?
I have found that if I redefine the schema like so:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://automation.granite.com/service-request.xsd" targetNamespace="http://automation.granite.com/service-request.xsd">
<xs:element name="methodCall">
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:methodName"/>
<xs:element ref="tns:params"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="methodName" type="xs:string"/>
<xs:element name="params" type="tns:ParamsType"/>
...................... (etc)
that I am able to reference the values of these nodes. The issue I have with this approach is that for schemas with many elements, XMLBeans generates a source, class and other files for each top-level element!
Please advise.
Mike Morris
Systems Integration
Telcordia Technologies - Granite Systems SBU
1228 Elm Street
Manchester, NH 03101
phone - 603-263-6462
fax - 603-669-9839
morrim@telcordia.com <ma...@telcordia.com>
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/