• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using JSP to call xalan parser

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all, I'm fairly new to xml and I have little bit more jsp under my belt. I;m working on a project that requires the use of jsp pages that take the data sent in from forms and parses it from the xml file. The parser is Xalan. Can anyone tell me how to call the xalan parser from the JSP page to parse my xml and extract the pertinent data? Any ideas or suggestions are welcomed.
T.H.
 
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Here is the way to go about this problem.
1. You will get XML in the form of String or Stream in the JSP file.
2. The parser you are using can be of DOM or SAX. I am not sure of XALAN. I think it is DOM parser. There will be methods to pass this XML in to the parser instant in the form of String or Stream.
3. Create the parser instant in the JSP file or Servlet and pass the XML to the parser.
4. Now the parser will be loded with your XML and you traverse and do the work on this XML in your JSP or Servlet.

Hope this helps.
Cheers.
 
Author
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general, I'd recommend using JSTL's standard <x:parse> and <x:transform> tags; you don't want to tie yourself to a specific XSLT processor or XML parser.
See http://java.sun.com/products/jstl for more information on JSTL, the JSP Standard Tag Library.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic