
|
If you were logged in you would be able to see more operations.
|
|
|
|
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
|
|
Description
|
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
|
Show » |
|
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