• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

How to parse a xml string?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Everybody's invited. Except this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic