Bookmark Topic Watch Topic
  • New Topic

create a TXElement and get a TXText

 
Barbara Foute Nelong
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
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:
<application>
<type>
<number/>
<kind/>
</type>
<client>
<demo>
<first_name/>
<last_name/>
<salutation/>
<age/>
<marital_status/>
</demo>
</client>
</application>
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.
code:
NonValidatingTXDOMParser parser = new NonValidatingTXDOMParser();
parser.parse(new InputSource(xml));
doc = (com.ibm.xml.parser.TXDocument)parser.getDocument();
now I want to find the element "type" in my datastructure and visit its children:
for(Node node=doc.getDocumentElement().getFirstChild();
node!=null;
node.getNextSibling()){
if(node.getNodeName().equalsIgnoreCase("type")){.....}
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
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Asked and answered here.
 
    Bookmark Topic Watch Topic
  • New Topic