Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
XmlSchema 1.4.5
-
Java6 + Windows7
Description
SchemaBuilder is ruturning only the first key, keyref and unique element when handling multiple keys, keyrefs or unique definitions inside the same element and the shema elemets are using namespace prefix.
<xs:element name="Element1" type="Element1Type">
<xs:keyref name="keyRef1" refer="Key1">
<xs:selector xpath="xxxxx"/>
<xs:field xpath="@Name"/>
</xs:keyref>
<xs:keyref name="keyRef2" refer="Key1">
<xs:selector xpath="xxxx"/>
<xs:field xpath="@Name"/>
</xs:keyref>
</xs:element>
The SchemaBuilder will generate information only for the first keyref for this element.
XmlSchemaBuilder should use XDOMUtil.getNextSiblingElementNS() method instead XDOMUtil.getNextSiblingElement() like it does when it looks for the first element.
if ((keyEl = XDOMUtil.getFirstChildElementNS(el, XmlSchema.SCHEMA_NS,
"key")) != null) {
while (keyEl != null)
}
if ((keyrefEl = XDOMUtil.getFirstChildElementNS(el,
XmlSchema.SCHEMA_NS, "keyref")) != null) {
while (keyrefEl != null) {
XmlSchemaKeyref keyRef = (XmlSchemaKeyref) handleConstraint(
keyrefEl, "Keyref");
if (keyrefEl.hasAttribute("refer"))
element.constraints.add(keyRef);
keyrefEl = XDOMUtil.getNextSiblingElementNS(keyrefEl, XmlSchema.SCHEMA_NS, "keyref");
}
}
if ((uniqueEl = XDOMUtil.getFirstChildElementNS(el,
XmlSchema.SCHEMA_NS, "unique")) != null) {
while (uniqueEl != null)
}