Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / August 2005

Tip: Looking for answers? Try searching our database.

Bug in Oracle org.w3c.dom.Node ?

Thread view: 
marvin_123456@yahoo.com - 10 Aug 2005 10:11 GMT
Hello,

I am using Oracle 10g for retrieving XML documents as XMLType and
manipulate them in Java, using the method
org.w3c.dom.Node.setTextContent() to set the text child node of a DOM
node. The oracle DOM implementation just appends a child node to the
existing one and does not replace it like it is specified in the
interface documentation of org.w3c.dom.Node

Is this a bug or a feature or am I doing something wrong?

Any help is welcome.

Thank you,
Marvin
bjf@gmx.ch - 24 Aug 2005 15:55 GMT
Could you maybe post some code?
marvin_123456@yahoo.com - 25 Aug 2005 07:36 GMT
bjf@gmx.ch 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.