elena 2002/07/30 15:09:29
Modified: java/src/org/apache/xerces/dom ElementNSImpl.java
ElementImpl.java
Log:
Compute baseURI value of element
Revision Changes Path
1.25 +19 -3 xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java
Index: ElementNSImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ElementNSImpl.java 24 Jul 2002 19:08:41 -0000 1.24
+++ ElementNSImpl.java 30 Jul 2002 22:09:29 -0000 1.25
@@ -61,6 +61,9 @@
import org.w3c.dom.DOMException;
import org.w3c.dom.Attr;
+import org.apache.xerces.util.URI;
+
+
/**
* ElementNSImpl inherits from ElementImpl and adds namespace support.
@@ -325,12 +328,25 @@
if (needsSyncData()) {
synchronizeData();
}
+
+
+ String baseURI = this.ownerNode.getBaseURI();
if (attributes != null) {
Attr attrNode =
(Attr)attributes.getNamedItemNS("http://www.w3.org/XML/1998/namespace", "base");
if (attrNode != null) {
- return attrNode.getNodeValue();
+ String uri = attrNode.getNodeValue();
+ if (uri.length() != 0 ) {// attribute value is always empty string
+ try {
+ uri = new URI(new URI(baseURI), uri).toString();
+ }
+ catch (org.apache.xerces.util.URI.MalformedURIException e){
+ // REVISIT: what should happen in this case?
+ return null;
+ }
+ return uri;
+ }
}
}
- return this.ownerNode.getBaseURI();
+ return baseURI;
}
}
1.51 +16 -3 xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java
Index: ElementImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- ElementImpl.java 24 Jul 2002 19:08:41 -0000 1.50
+++ ElementImpl.java 30 Jul 2002 22:09:29 -0000 1.51
@@ -65,6 +65,8 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
+import org.apache.xerces.util.URI;
+
/**
* Elements represent most of the "markup" and structure of the
* document. They contain both the data for the element itself
@@ -202,13 +204,24 @@
if (needsSyncData()) {
synchronizeData();
}
+ String baseURI = this.ownerNode.getBaseURI();
if (attributes != null) {
Attr attrNode = (Attr)attributes.getNamedItem("xml:base");
if (attrNode != null) {
- return attrNode.getNodeValue();
+ String uri = attrNode.getNodeValue();
+ if (uri.length() != 0 ) {// attribute value is always empty string
+ try {
+ uri = new URI(baseURI, uri).toString();
+ }
+ catch (org.apache.xerces.util.URI.MalformedURIException e){
+ // REVISIT: what should happen in this case?
+ return null;
+ }
+ return uri;
+ }
}
}
- return this.ownerNode.getBaseURI();
+ return baseURI;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]