This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to parse a xml string?  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
How to parse a xml which is in the form of string? I couldn't find API's for directly parsing the xml string (I am using JAXP). I don't want either to store the string into a file or using IO classess i.e. StringReader.
Thanks in advance.
Regards,
Jayakumar
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
use microsoft's DOM parser, which is inbuilt in IE 5.x
u should achieve it easily
naren.
 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi narenkumar!
I have to use JAXP or anyother java based parser because I am working in EJB applications. Can you please suggest me any other java based parser. And one thing I am wondering, why the org.w3c.dom.Document is not made as serializable.?
Regards,
jayakumar

Originally posted by narenkumar:
hi,
use microsoft's DOM parser, which is inbuilt in IE 5.x
u should achieve it easily
naren.


 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is hardly a problem. Almost all the parsers has overloaded parse methods that take InputStream, InputSource and String as arguments. You can use any of these.
Checkout the parser documentation to see what flavours of parse methods are available...
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajith Kallambella!
I can't use InputStream or InputSource, because we can't use IO packages in EJB applications. Regarding the String parameter, that string is the URI not the xml string. Am I correct? If not correct me. And any alternate ways please.
Regards,
Jayakumar

Originally posted by Ajith Kallambella:
This is hardly a problem. Almost all the parsers has overloaded parse methods that take InputStream, InputSource and String as arguments. You can use any of these.
Checkout the parser documentation to see what flavours of parse methods are available...


 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not an EJB guru, but if what you're saying is true, that is a serious shortcoming of EJBs.
I just can't think of a way to do this since all parsers either take an URI or a stream-based input as the argument. URI is ruled out since you don't want to store the incoming string into a file. Stream-based is ruled out since you say you can't use any IO streams....
Let me ask you this. In the original question you said "). I don't want either to store the string into a file or using IO classess i.e. StringReader." Is it because EJBs don't support IO streams or is it your design decision ??
 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is because we can't use IO streams in EJB and it is not my design decision.
Regards,
Jayakumar
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!