Re: Bug in Oracle org.w3c.dom.Node ?



bjf@xxxxxx schrieb:

> Could you maybe post some code?


Here is an example:

----
String xml = "<a><b>1</b></a>";

DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
fac.setIgnoringElementContentWhitespace(true);

DocumentBuilder builder;
builder = fac.newDocumentBuilder();

Document doc = builder.parse(new InputSource(new StringReader(xml)));
Node n = doc.getElementsByTagName("b").item(0);

n.setTextContent("2");

System.out.println(n.getClass());
System.out.println(n.getTextContent());
----

the output is:

class oracle.xml.parser.v2.XMLElement
12

When I set

System.setProperty("javax.xml.parsers.DocumentBuilderFactory",

"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");

the output is:

class com.sun.org.apache.xerces.internal.dom.DeferredElementImpl
2


The latter shows the behaviour like in DOM-Api specified.
I am using Java 1.5.

Thanks,
Marvin

.



Relevant Pages

  • create a DOCTYPE element with JAXP
    ... DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance; ... DocumentBuilder builder = factory.newDocumentBuilder; ... DOMImplementation impl = builder.getDOMImplementation; ...
    (comp.lang.java.programmer)
  • Re: DOM Kommentare
    ... DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance; ... Document doc = db.parse; ... XPath xpath = XPathFactory.newInstance.newXPath; ... String commentText = xpath.evaluate(expression, doc, ...
    (de.comp.lang.java)
  • Re: documentBulder.parse(string) returns [#document: null]
    ... DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance; ... the 'setErrorHandler' method to fix this. ...
    (comp.lang.java.programmer)
  • Re: validate xml with a dtd in java
    ... Mithil wrote: ... DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance; ... Document doc = db.parse); ...
    (comp.lang.java.programmer)