File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes create a TXElement and get a TXText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply locked New topic

create a TXElement and get a TXText

Barbara Foute Nelong

Joined: Nov 30, 2000
Posts: 20
Hello everyone,
can anybody shed light on my problem?
I create an xml document with the ibm parser, I print the result to the console and I get:
wich is exactly the data structure I want. I save it to a file.
Now I want to get the file, parse it and loop through the nodes to get to a specific node.
NonValidatingTXDOMParser parser = new NonValidatingTXDOMParser();
parser.parse(new InputSource(xml));
doc = (;
now I want to find the element "type" in my datastructure and visit its children:
for(Node node=doc.getDocumentElement().getFirstChild();
I cannot get pass this point because the node.getNodeName always returns "#text".
A system.out.println(node) reveals that the parser see the element (that I have created as TXElement) as a TXtext...
Anybody knows why?
Any way around it?

[This message has been edited by Barbara Foute Nelong (edited July 08, 2001).]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Asked and answered here.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: create a TXElement and get a TXText
It's not a secret anymore!