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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to