You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Hudson (Jira)" <ji...@apache.org> on 2020/01/03 14:11:00 UTC

[jira] [Commented] (XMLSCHEMA-51) Problem with included schemas with attribute group references

    [ https://issues.apache.org/jira/browse/XMLSCHEMA-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007507#comment-17007507 ] 

Hudson commented on XMLSCHEMA-51:
---------------------------------

FAILURE: Integrated in Jenkins build xmlschema-master-analysis #79 (See [https://builds.apache.org/job/xmlschema-master-analysis/79/])
XMLSCHEMA-51 Problem with included schemas with attribute group (coheigea: rev 4980f932c5dda824f3c1ebaccf8b90da3f10e828)
* (edit) xmlschema-core/src/test/java/tests/IncludeTest.java
* (add) xmlschema-core/src/test/resources/include-union-without-ns/root.xsd
* (edit) xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
* (add) xmlschema-core/src/test/resources/include-union-without-ns/datatypes.xsd


> Problem with included schemas with attribute group references
> -------------------------------------------------------------
>
>                 Key: XMLSCHEMA-51
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-51
>             Project: XmlSchema
>          Issue Type: Question
>            Reporter: Fady Moussallam
>            Assignee: Colm O hEigeartaigh
>            Priority: Major
>             Fix For: 2.2.5
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Hello,
> I am using version 2.2.3.
> I have a problem with a combination of included schemas and attribute group references.
> Say you have schemaA including schemaB. schemaB does not have a default namespace, nor a target namespace, since it is meant to be included. It therefore inherits the namespace of the including schema (in this case schemaA).
> The problem arises if schemaB contains markup like this:
> {code}
> <xs:attributeGroup ref="QuantityGroup"/>
>  ...
>  </xs:attributeGroup>
> {code}
> In org.apache.ws.commons.schema.SchemaBuilder#handleAttributeGroupRef the reference QName is obtained with the getRefQName(String pName, Node pNode) method.
> In this method, the namespace is derived using the NodeNamespaceContext.getNamespaceContext(pNode) method. This one in turn determines available namespaces directly from the DOM using PrefixCollector.searchAllPrefixDeclarations(pNode).
> Problem is that from a DOM standpoint schemaB does not contain any namespace declarations. So the reference QName end up having no namespace.
> This seems wrong and creates problems when later on you want to find the referenced group using XmlSchemaCollection#getAttributeGroupByName(QName name) which returns null.
> I can fix my issue in SchemaBuilder#getRefQName by doing this:
> {code}
> ...
> if (offset == -1) {
>  uri = pContext.getNamespaceURI(Constants.DEFAULT_NS_PREFIX);
>  if (Constants.NULL_NS_URI.equals(uri)) {
>  if (currentSchema.getLogicalTargetNamespace().isEmpty()) {
>  return new QName(Constants.NULL_NS_URI, pName);
>  } else {
>  return new QName(currentSchema.getLogicalTargetNamespace(), pName);
>  }
>  }
>  localName = pName;
>  prefix = Constants.DEFAULT_NS_PREFIX;
>  } else {
> ...
> {code}
> But I am not sure if there are any side effects.
> Any opinion or advice on this would be very appreciated.
> Thank you
>  
> Fady
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org