text() will attempt to do a recursive walk of the sub-tree,
and assemble only the text portion. text() applied to
your <row> element should produce something like:
601133922 US Dollar 3 601133902 null Category Currently List
text() applied to a <value> tag should get the text within it,
but since you have a fairly flat hierarchy, getTextTrim() might
also be a good solution for you, since you don't need the semantics
of recursion.
columnNode.getTextTrim() would produce 601133922 for the first
<value> child of <row>.
Does that help at all?
-bob
On Mon, 29 Oct 2001, Doug Hoppes wrote:
> Hi all,
>
> I posted last week about a problem with the .valueOf("text()") not
> getting the correct node. I finally got back to the problem and wrote a
> quick java program to read my data file and show what is happening.
> Where would the best place be to post the data file and java code?
>
> Using the code to write out my Xml Tree:
>
> FileOutputStream out = new FileOutputStream("data.out");
> OutputFormat format = OutputFormat.createPrettyPrint();
> XMLWriter writer = new XMLWriter(out,format);
> writer.write(_domTree);
> writer.close();
> out.close();
>
> I get the Xml portion (in question) to be:
> .....
> <row id="22">
> <value>601133922</value>
> <value>US Dollar</value>
> <value>3</value>
> <value>601133902</value>
> <value>null</value>
> <value>Category</value>
> <value>Currency List</value>
> .....
>
> When I use: _columnNode.valueOf("."), I get 60 1133902
> _columnNode.valueOf("text()"), I get 60
> _columnNode.getStringValue(), I get 60 1133902
>
> The Xml file I'm trying to parse through is approximately 176K. If
> there is anyone that could help me with this problem as soon as
> possible, I would greatly greatly appreciate it.
>
> Doug Hoppes
> Charles River Development
> 781-238-0099 x269
>
>
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev