-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b30
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2074224 | 1.3.0 | Neeraj Bajaj | P3 | Closed | Fixed | 1.3 |
Name: eaR10174 Date: 09/03/2003
The method Node.getBaseURI() returns null in case when the base URI is defined by the
attribute 'xml:base' in a root element (see test.java below). According to the method
javadoc
public String getBaseURI()
The absolute base URI of this node or null if undefined. This value is computed
according to [XML Base].
the method should return the defined uri.
The bug appears in jdk1.5.0beta-b17 and affects a new JCK1.5 test:
api/org_w3c/dom/Node/index.html#GetBaseURI
------------------------------------test.java-----------------------------
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import java.io.StringReader;
public class test {
String data =
"<?xml version='1.0' ?>"
+ "<root xml:base='http://xxx.yyy/' />";
DocumentBuilder docBuilder = null;
public static void main(String argv[]) {
new test().run();
}
public void run() {
try {
DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
docBuilder = docBF.newDocumentBuilder();
Document doc = parse(data);
System.out.println(doc.getDocumentElement().getBaseURI());
} catch (Exception e) {
e.printStackTrace();
return;
}
}
private Document parse(String xmlData) throws Exception {
StringReader in = new StringReader(xmlData);
InputSource source = new InputSource(in);
return docBuilder.parse(source);
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b17)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b17, mixed mode)
null
--------------------------------------------------------------------------
======================================================================
The method Node.getBaseURI() returns null in case when the base URI is defined by the
attribute 'xml:base' in a root element (see test.java below). According to the method
javadoc
public String getBaseURI()
The absolute base URI of this node or null if undefined. This value is computed
according to [XML Base].
the method should return the defined uri.
The bug appears in jdk1.5.0beta-b17 and affects a new JCK1.5 test:
api/org_w3c/dom/Node/index.html#GetBaseURI
------------------------------------test.java-----------------------------
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import java.io.StringReader;
public class test {
String data =
"<?xml version='1.0' ?>"
+ "<root xml:base='http://xxx.yyy/' />";
DocumentBuilder docBuilder = null;
public static void main(String argv[]) {
new test().run();
}
public void run() {
try {
DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
docBuilder = docBF.newDocumentBuilder();
Document doc = parse(data);
System.out.println(doc.getDocumentElement().getBaseURI());
} catch (Exception e) {
e.printStackTrace();
return;
}
}
private Document parse(String xmlData) throws Exception {
StringReader in = new StringReader(xmlData);
InputSource source = new InputSource(in);
return docBuilder.parse(source);
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b17)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b17, mixed mode)
null
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2074224 getBaseURI() returns null when base URI is defined
- Closed