Java NonValidatingDomParser problem with blank lines in XML

Discussion in 'XML' started by derek b, Sep 18, 2003.

  1. derek b

    derek b Guest

    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
    #text.

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


    <ShipToAddress2>Address Line 2</ShipToAddress2>
    <ShipToCity>Oak Park</ShipToCity>
    <ShipToState>IL</ShipToState>
    <ShipToPostalCode>60302</ShipToPostalCode>
    <ShipToCountry>US</ShipToCountry>
    <ShipToPhoneNum>555-555-5555</ShipToPhoneNum>
    </ShipToSection>

    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
    need.

    Thanks for any help you can provide
     
    derek b, Sep 18, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. derek b
    Replies:
    0
    Views:
    472
    derek b
    Sep 18, 2003
  2. ricky
    Replies:
    1
    Views:
    807
    Joris Gillis
    Oct 17, 2004
  3. WuyaSea Operator
    Replies:
    48
    Views:
    1,480
    Ben Phillips
    Sep 24, 2007
  4. Janis
    Replies:
    7
    Views:
    181
    Dr J R Stockton
    Nov 8, 2006
  5. Cah Sableng
    Replies:
    0
    Views:
    244
    Cah Sableng
    Apr 23, 2007
Loading...

Share This Page