You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Carlos Guzmán Álvarez <ca...@altia.es> on 2007/05/28 16:00:01 UTC
[XmlSchema] Possible bug in SchemaBuilder
Hello:
I have found a possible bug in SchemaBuilder when handling multiple
keys, keyrefs or unique definitions
inside the same element, it's returning only the first one, an example:
<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.
I haev fixed it by changing the call that gets the sibling keyref
elements to getNextSiblingElementNS:
if ((keyrefEl = XDOMUtil.getFirstChildElementNS(el,
XmlSchema.SCHEMA_NS, "keyref")) != null) {
while(keyrefEl != null) {
XmlSchemaKeyref keyRef = (XmlSchemaKeyref)
handleConstraint(keyrefEl, "Keyref");
if(keyrefEl.hasAttribute("refer")) {
String name = keyrefEl.getAttribute("refer");
keyRef.refer = getRefQName(name, el);
}
element.constraints.add(keyRef);
*keyrefEl = XDOMUtil.getNextSiblingElementNS(keyrefEl,
XmlSchema.SCHEMA_NS, "keyref");*
}
}
But i'm not sure whether the fix is really correct :)
Would the fix be really correct ??
Thanks in advance !!
--
Best regards
Carlos
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org