Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

java XML parse problem

Options
  • 21-03-2005 6:57pm
    #1
    Registered Users Posts: 3,958 ✭✭✭


    Hi,
    does anyone know a way to parse partial incomplete xml documents, e.g. an xml document that doesnt have a closing root tag..
    or doesnt require the opening tag when parsing.?

    im developing an extremely cut down jabber client (setting up stream/messaging/presence) and i cant see which xml parser would be best.. ?

    ANY suggestions would be GREATLY appreciated


Comments

  • Registered Users Posts: 885 ✭✭✭clearz


    Why would you be using xml that aint well formed. Try parsing it using SAX and not the DOM. You could always just read it in using a standard InputStream and manually parse it yourself using the String functions.


  • Closed Accounts Posts: 139 ✭✭utopian


    Hi,
    does anyone know a way to parse partial incomplete xml documents, e.g. an xml document that doesnt have a closing root tag..
    or doesnt require the opening tag when parsing.?

    "partial incomplete xml documents" are not xml, so no XML parser will accept them. Missing closing tags (and certain missing parent tags) *may* be handled by an SGML parser. Not requiring an opening tag? What's that supposed to mean?

    There are also HTML "tagsoup" parsers, which might be worth investigating.


  • Registered Users Posts: 3,958 ✭✭✭Chad ghostal


    Thanks for the suggestions lads i've decided on SAX,
    its kind of does what i want.. just very awkwardly..

    i was a little unclear in my post (its driving me nuts)
    i wanted to be able to read in a part of a document, process it, then send a reply to that part, then read another part, then reply etc etc... untill the end came when i would just send the closing tag and cut the connection.

    I think i figured out a way using SAX, its awkward, but i've no choice, im running out of time ..
    thanks again.


  • Registered Users Posts: 261 ✭✭HaVoC


    sjsxp in the java 1.5 wsdp might be easier to used then sax.

    Its java's version of a pull parser(reads in xml line by line using a cursor and events).
    Its non validating so it should work.


Advertisement