Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Java NonValidatingDomParser problem with blank lines in XML

Thread Tools

Java NonValidatingDomParser problem with blank lines in XML

derek b
Posts: n/a
I can parse files with no problem. The issue comes in when I am
actually going through the document to populate my objects. Any blank
lines are coming in as "#text" items. I can easily enough force the
items to "instanceof element", but I figured there has to be someway
to let java handle this.

For instance the following XML show up with 2 lines with a value of

<ShipToName>Test user</ShipToName>
<ShipToAddress1>New Test Line 1</ShipToAddress1>

<ShipToAddress2>Address Line 2</ShipToAddress2>
<ShipToCity>Oak Park</ShipToCity>

In testing it, I find if I do use a DOM it controls those values,
however I am not in a position choose to create a DOM. We are
receiving this from another vender which is not providing a DOM.

As I said before I can check the values to be "instanceof element",
but I figured thats going to provide a bit of unwanted overhead for
every line. I figure the parser can do this, I just don't know how.
I basically want all opening and closing tags, and any text elements
that may fall between the open and close. I have tried playing with
the ignorablewhitespace() method...but that doesn't seem to do what I

Thanks for any help you can provide
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
one interview question, 17 lines in java, 3 lines in ruby. WuyaSea Operator Java 48 09-24-2007 01:50 AM
Re: one interview question, 17 lines in java, 3 lines in ruby. Lew Java 0 09-20-2007 12:34 AM
Preserve blank lines when add multiple lines of text to a cell Cah Sableng Javascript 0 04-23-2007 04:46 AM
XSL & XML newbie: How to get rid of blank lines in output?? ricky XML 1 10-17-2004 08:28 PM
Java NonValidatingDomParser Problem derek b XML 0 09-18-2003 05:28 PM