You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "George Cristian Bina (JIRA)" <xe...@xml.apache.org> on 2005/11/15 15:25:30 UTC

[jira] Created: (XERCESJ-1113) Support for xml:id

Support for xml:id
------------------

         Key: XERCESJ-1113
         URL: http://issues.apache.org/jira/browse/XERCESJ-1113
     Project: Xerces2-J
        Type: New Feature
  Components: XInclude 1.0  
    Versions: 2.7.1    
 Environment: All
    Reporter: George Cristian Bina


Hi,

The XInclude ID support should handle xml:id. This is useful for instance with DocBook or TEI that use Relax NG schemas for validation and also need XInclude support.
Here it is a patch that adds support for handling xml:id attributes as attributes of ID type.

Index: C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java
===================================================================
--- C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java	(revision 344362)
+++ C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java	(working copy)
@@ -162,6 +162,17 @@
             }
         }
         
+        if (normalizedValue == null && attributes != null) {
+        	// Try to see if we can get an xml:id
+        	for (int i = 0; i < attributes.getLength(); i++) {
+        		if ("xml".equals(attributes.getPrefix(i)) && 
+        				"id".equals(attributes.getLocalName(i))) {
+        			normalizedValue = attributes.getValue(i);
+        			break;
+        		}
+        	}        	
+        }
+        
         if (normalizedValue != null
                 && normalizedValue.equals(fShortHandPointer)) {
             return true;

Best Regards,
George


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESJ-1113) Support for xml:id

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESJ-1113?page=comments#action_12362168 ] 

Michael Glavassevich commented on XERCESJ-1113:
-----------------------------------------------

[[Recording a comment I sent in an e-mail back in December]]

I see how the patch gets the job done for some cases though I'm not sure whether a conforming XInclude processor should be doing this by default. That aside, since it isn't performing the processing steps required by the xml:id spec [1] you can't really call this support for xml:id and in general it will miss values because they haven't been fully normalized.

xml:id processing is logically a separate processing layer from XInclude, schema validation, etc... I understand the usefulness of xml:id in an XInclude context but this attribute has broader usage. When Xerces eventually does support xml:id I feel it should be independent of the other components in the pipeline.

[1] http://www.w3.org/TR/xml-id/#processing

> Support for xml:id
> ------------------
>
>          Key: XERCESJ-1113
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1113
>      Project: Xerces2-J
>         Type: New Feature
>   Components: XInclude 1.0
>     Versions: 2.7.1
>  Environment: All
>     Reporter: George Cristian Bina

>
> Hi,
> The XInclude ID support should handle xml:id. This is useful for instance with DocBook or TEI that use Relax NG schemas for validation and also need XInclude support.
> Here it is a patch that adds support for handling xml:id attributes as attributes of ID type.
> Index: C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java
> ===================================================================
> --- C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java	(revision 344362)
> +++ C:/george/workspace/xerces/src/org/apache/xerces/xpointer/ShortHandPointer.java	(working copy)
> @@ -162,6 +162,17 @@
>              }
>          }
>          
> +        if (normalizedValue == null && attributes != null) {
> +        	// Try to see if we can get an xml:id
> +        	for (int i = 0; i < attributes.getLength(); i++) {
> +        		if ("xml".equals(attributes.getPrefix(i)) && 
> +        				"id".equals(attributes.getLocalName(i))) {
> +        			normalizedValue = attributes.getValue(i);
> +        			break;
> +        		}
> +        	}        	
> +        }
> +        
>          if (normalizedValue != null
>                  && normalizedValue.equals(fShortHandPointer)) {
>              return true;
> Best Regards,
> George

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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