Apache Xerces SAX parser and XSL
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   A_JP
Posted On:   Thursday, September 5, 2002 11:37 AM

Hi ! Iam using Apache Xerces for parsing XML document. Iam new to XML, so got couple of questions. 1. In DOM, Iam able to access a particular element (tag) and get the value using getNodeValue() method. How to do the same, that is go to a particular element and get the value in SAX parser. Does the SAX API provide any method for it. If not then how should it be done. Any sample code (for accessing element value) or web site having sample code is appreciated. 2. Iam also trying to learn XSL. For having XSL work, do I need to use XSLT processor like xalan. Without any processor, can I run XSL. My understanding of XSL for XML is, like CSS for HTML. For using CSS for HTML, I don't need any processor. Similarly, will XSL work without an   More>>

Hi !
Iam using Apache Xerces for parsing XML document. Iam new to XML, so got couple of questions.

1. In DOM, Iam able to access a particular element (tag) and get the value using getNodeValue() method. How to do the same, that is go to a particular element and get the value in SAX parser. Does the SAX API provide any method for it. If not then how should it be done. Any sample code (for accessing element value) or web site having sample code is appreciated.

2. Iam also trying to learn XSL. For having XSL work, do I need to use XSLT processor like xalan. Without any processor, can I run XSL. My understanding of XSL for XML is, like CSS for HTML. For using CSS for HTML, I don't need any processor. Similarly, will XSL work without any. It would be great if you let me know about the functionality of xalan in XML.

Thx
AJP

   <<Less

Re: Apache Xerces SAX parser and XSL

Posted By:   Roseanne_Zhang  
Posted On:   Thursday, September 5, 2002 04:48 PM

Here is an excellent lecture notes might help you a lot:

http://www.cs.rpi.edu/~puninj/XMLJ/toc.html

Re: Apache Xerces SAX parser and XSL

Posted By:   Roseanne_Zhang  
Posted On:   Thursday, September 5, 2002 02:43 PM


  1. SAX is event driven, you need to extend org.xml.sax.helpers.DefaultHandler which has methods like startElement endElement, you can get and process the value from there. Here has some sample code http://www.ecerami.com/xerces/
  2. Using XSL definitely needs a processor, even you using XSL enabled browser, you still need a processor which is provided by the browser, even you might not be aware of it.

Re: Apache Xerces SAX parser and XSL

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, September 5, 2002 12:40 PM

SAX is an event-driven parser. You give it an event handler, a method, to call, when and if it encounters the element you are interested in.

About | Sitemap | Contact