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 "Martin Kvapil (JIRA)" <ji...@apache.org> on 2010/04/06 11:29:33 UTC

[jira] Issue Comment Edited: (WSCOMMONS-531) SchemaBuilder does not parse all the 'key' and 'keyref' definitions when it uses namespace prefix

    [ https://issues.apache.org/jira/browse/WSCOMMONS-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853822#action_12853822 ] 

Martin Kvapil edited comment on WSCOMMONS-531 at 4/6/10 9:28 AM:
-----------------------------------------------------------------

Now I have created the patch against branch 1_4_X_BRANCH. This should work without problem.
But in the trunk is the same bug!

      was (Author: martan):
    Now I have created the patch against branch 1_4_X_BRANCH. This should work without problem.
  
> SchemaBuilder does not parse all the 'key' and 'keyref' definitions when it uses namespace prefix
> -------------------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-531
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-531
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: XmlSchema
>    Affects Versions: XmlSchema 1.4.5
>         Environment: Java6 + Windows7
>            Reporter: Martin Kvapil
>            Assignee: Benson Margulies
>         Attachments: SchemaBuilder.java-1.4.x.patch
>
>
> 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) {
> 				element.constraints.add(handleConstraint(keyEl, "Key"));
> 				keyEl = XDOMUtil.getNextSiblingElementNS(keyEl, XmlSchema.SCHEMA_NS, "key");
> 			}
> 		}
> 		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");
> 			}
> 		}
> 		if ((uniqueEl = XDOMUtil.getFirstChildElementNS(el,
> 				XmlSchema.SCHEMA_NS, "unique")) != null) {
> 			while (uniqueEl != null) {
> 				element.constraints.add(handleConstraint(uniqueEl, "Unique"));
> 				uniqueEl = XDOMUtil.getNextSiblingElementNS(uniqueEl, XmlSchema.SCHEMA_NS, "unique");
> 			}
> 		}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.