lost_trekkie
lost_trekkie

Reputation: 105

How to convert a 'prepared' text file to an XML file using Java? To be subsequently used in SAX

I'm working on this application at the moment that uses XML to transmit data. The characters in the XML file is hard copied to a text file and then transmitted (we're working to compensate for very limited infrastructure). The link below should demonstrate. The text file basically has one long string of characters.

http://pastebin.com/K4Vft9Uh

I'm looking for a way to convert this file back to XML format like so :

http://pastebin.com/i7b9xKf5

Which is basically the regular XML structure.

I need to use SAX with the resultant XML so that i can interface with the rest of the application. Could anyone help with this? I'm guess simply changing the extension type of the file and feeding it to SAX isn't going to help.

This has to be used in an environment with very limited resources (memory, CPU power), eg. on mobile phones, so I cant use DOM.

I'm very new to XML files and parsers. I've looked all over the net to no avail and hence I've posted here. Thank you in advance.

Upvotes: 0

Views: 656

Answers (1)

jtahlborn
jtahlborn

Reputation: 53694

Um, maybe i'm missing something, but both of those files are xml. the second is just "pretty printed". you don't need to "pretty print" xml in order to parse it with a sax (or any other) xml parser.

Upvotes: 1

Related Questions