Java NonValidatingDomParser Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • derek b

    #1

    Java NonValidatingDomParser Problem

    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.

    <ShipToSectio n>
    <ShipToName>Tes t user</ShipToName>
    <ShipToAddress1 >New Test Line 1</ShipToAddress1>


    <ShipToAddress2 >Address Line 2</ShipToAddress2>
    <ShipToCity>O ak Park</ShipToCity>
    <ShipToState>IL </ShipToState>
    <ShipToPostalCo de>60302</ShipToPostalCod e>
    <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 ignorablewhites pace() method...but that doesn't seem to do what I
    need.

    Thanks for any help you can provide
Working...