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

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

Hi Ishara,

The changes you're proposing to XML11Configuration look correct, though in 
future it would be easier to review changes to existing files if you created a 
patch (e.g. diff -u). Generally also better to add source files as an 
attachment to the JIRA issue rather than including it directly as a comment.

Guessing you may have changed XmlIDHandler since June 29th, but wanted to point 
out some things to improve in startElement(). Processing of xml:id should be 
done regardless of whether the XML version is XML 1.0 or 1.1. You only need to 
process that one attribute, so when you look up the index with 
attributes.getIndex("xml:id"), just use that index to get the attribute value. 
You don't need a loop and should not be normalizing the attributes which are 
not xml:id.

Thanks.

> [GSoC]: Support for xml:id
> --------------------------
>
>                 Key: XERCESJ-1113
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1113
>             Project: Xerces2-J
>          Issue Type: New Feature
>          Components: XInclude 1.0
>    Affects Versions: 2.7.1
>         Environment: All
>            Reporter: George Cristian Bina
>              Labels: gsoc2011
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to