• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parser to read and write XML with namespace  RSS feed

 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Java application receives a XML string from another application (TIBCO app). In my Java app I need to read, modify and send back the modified XML string to the application (TIBCO). The input XML string looks something like this:



Please suggest an efficient parser which can help me achieve this. Please note, I will have to send back the XML in the exact format,i.e, with namespace declaration and namespace prefixes. The choice of parser would be one which consumes less memory and is fast. Also, at this point of time the XML content is not very big but might increase in future hence memory usage is a consideration.

P.S: Please ignore any syntax errors in the XML as I have typed it and not copy pasted from the app.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any XML parsers should be able to handle namespaces correctly.
 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul. In terms of simplicity which one would be better out of SAX and STAX ? I am keeping DOM out of question because DOM will need more memory compared to SAX/STAX.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know because I don't know what exactly your application does. If you're looking for simplicity you should not rule out DOM -- right now ruling it out because it uses more memory is just premature optimization.

However since your stated requirements are "to read, modify and send back the modified XML" I would consider using XSLT to do that. Of course the major undefined term in that description is "modify"... the exact meaning of that term in your application is going to be what controls its complexity.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!