Board index » jbuilder » Question about SAX Parser

Question about SAX Parser


2004-06-04 01:35:18 AM
jbuilder9
Hi There,
I am trying to extend the SAX Parser to do this scenario:
I have this XML structure:
<data>
<object>...</object>
<object>...</object>
<object>...</object>
</data>
and would like to parse it into a file in this way: (Wrap each <object>tag
into a <test>tag)
<data>
<test>
<object>...</object>
</test>
<test>
<object>...</object>
</test>
<test>
<object>...</object>
</test>
</data>
How can I do that with SAX? RIght now I am using the example file of
Java.sun echo01.java. Do I have to extend some kind of methods and improve
them? I appreaciate any help or ideas.
Houman
 
 

Re:Question about SAX Parser

On 6/3/2004 at 1:35:18 PM, Houman Khorasani wrote:
Quote
I am trying to extend the SAX Parser to do this scenario:
would like to parse it into a file in this way: (Wrap each <object>
tag into a <test>tag)
How can I do that with SAX?
With SAX, you would need to recognize the start of the <object>element
and write the <test>tag before the <object>, and recognize the end of the
element and write the closing </test>tag after the element.
Have you used XSLT? It should be very easy to add the <test>... </test>
tags using it.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
www.JPMcGrath.net/newsgroups/e-mail.html
 

Re:Question about SAX Parser

Actually you are right. It was much easier with XSLT.
Regards
Houman
 

{smallsort}