Hi All!
A have a simple XML format:
<page>
<container>
<componentdef type="type1">
<property name="path" value="/WEB-INF/components/hello.jsp"/>
</componentdef>
<componentref id="ref1"/>
</container>
</page>
The "container" element contains zero or more "componentdef" and
"componentref" elements in
any order. Part of XSD:
...
<xs:complexType name="container">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="componentdef" type="bl:componentdef"/>
<xs:element name="componentref" type="bl:componentref"/>
</xs:choice>
...
</xs:complexType>
...
The "Container" class (generated by xmlbeans) contains a
getComponentdefArray() and a
getComponentrefArray() methods. But I need the real order of these
elements. So I decided
to use DOM API:
NodeList nodes = container.getDomNode().getChildNodes();
for (int i=0; i<nodes.getLength(); i++) {
Node node = nodes.item(i);
String name = node.getNodeName();
System.out.println(node);
if (name.equals("componentdef")) {
Componentdef componentdef =
Componentdef.Factory.parse(node);
...
} else if (name.equals("componentref")) {
Componentref componentref =
Componentref.Factory.parse(node);
...
}
}
But during parsing, the following errors occur:
>> error: cvc-complex-type.4: Expected attribute: type
>> error: cvc-complex-type.2.4a: Expected element
'[EMAIL PROTECTED]://xyz.com/a' instead of '[EMAIL PROTECTED]://xyz.com/a' here
The system out contains:
<componentdef type="type1" xmlns="http://xyz.com/a">
<property name="path" value="/WEB-INF/components/hello.jsp"/>
</componentdef>,
How can I use the "parse" method to receive a valid object instance? Why
doesn't it find the "type" attribute when the node object has it?
Thanks, Tamas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]