You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2006/05/22 21:22:21 UTC
Re: [Sax-devel] Should I use sax?
Roberto Cosenza <li...@robcos.com> wrote on 05/22/2006 11:20:26 AM:
> Hi David. Thank you for your clarification.
> It is clear, SAX is the way to go for me.
> I confirm that sax is reading the doctype and doing the validation
> accordingly. It was missleading that the XMLSerializer was outputting
> the "Strict" doctype unregarding of the input one.
If you're writing new code, I would avoid using Xerces' native
serializers. They are non-standard, not particularly well maintained and
likely to be deprecated [1] soon (perhaps in the next release). JAXP's
TransformerHandler [2] is a much better choice for serializing SAX events.
> I have one more question:
> Parsing a document which contains the fragment
> <a href="mylink.html" >mylink</a>, generates events also for the
> a-attribute 'shape="rect"', which is not given in input!!
> Is there any way to turn this behavior off? It seems like the parser is
> inserting some implicit attributes here and there...
> /Roberto
[1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
[2]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/sax/TransformerHandler.html
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: [Sax-devel] Should I use sax?
Posted by Roberto Cosenza <ro...@robcos.com>.
Thanks for your help guys.
1) Does anybody have an example of how to serialize a SAX with the
TransformerHandler?
2) How do I put together the JAXP transformation with my SAX event
handlers? I want only the attributes which have the "specified" property
set. (thanx chris for the suggestion)
Seems that I have to write my own ContentHandler to output the XHTML.(?)
My idea is to have a DefaultHandler chained with with a XMLFilterImpl.
The DefaultHandler modifies the XHTML as I want and the chained filter
outputs it.
/roberto
Michael Glavassevich wrote:
> Roberto Cosenza <li...@robcos.com> wrote on 05/22/2006 11:20:26 AM:
>
>> Hi David. Thank you for your clarification.
>> It is clear, SAX is the way to go for me.
>> I confirm that sax is reading the doctype and doing the validation
>> accordingly. It was missleading that the XMLSerializer was outputting
>> the "Strict" doctype unregarding of the input one.
>
> If you're writing new code, I would avoid using Xerces' native
> serializers. They are non-standard, not particularly well maintained and
> likely to be deprecated [1] soon (perhaps in the next release). JAXP's
> TransformerHandler [2] is a much better choice for serializing SAX events.
>
>> I have one more question:
>> Parsing a document which contains the fragment
>> <a href="mylink.html" >mylink</a>, generates events also for the
>> a-attribute 'shape="rect"', which is not given in input!!
>> Is there any way to turn this behavior off? It seems like the parser is
>> inserting some implicit attributes here and there...
>> /Roberto
>
> [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
> [2]
> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/sax/TransformerHandler.html
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
--
Roberto Cosenza
ICQ 12231605, MSN & Jabber robcos AT robcos.com
Tel: +46-(0)70-4660928
Work Tel: +46-(0)8-55576860, Fax: +46-(0)8-55576861
--
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: [Sax-devel] Should I use sax?
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Roberto Cosenza <li...@robcos.com> wrote on 05/23/2006 03:55:44 AM:
> Thanks for your help guys.
>
> 1) Does anybody have an example of how to serialize a SAX with the
> TransformerHandler?
One of the samples [1] which ships with Xalan-J should show you how to
create one and use it.
> 2) How do I put together the JAXP transformation with my SAX event
> handlers? I want only the attributes which have the "specified" property
> set. (thanx chris for the suggestion)
>
> Seems that I have to write my own ContentHandler to output the XHTML.(?)
> My idea is to have a DefaultHandler chained with with a XMLFilterImpl.
> The DefaultHandler modifies the XHTML as I want and the chained filter
> outputs it.
TransformerHandler is a ContentHandler (and LexicalHandler/DTDHandler).
You could set it as the event receiver on your filter.
Thanks.
[1] http://xml.apache.org/xalan-j/samples.html
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: [Sax-devel] Should I use sax?
Posted by Roberto Cosenza <li...@robcos.com>.
Thanks for your help guys.
1) Does anybody have an example of how to serialize a SAX with the
TransformerHandler?
2) How do I put together the JAXP transformation with my SAX event
handlers? I want only the attributes which have the "specified" property
set. (thanx chris for the suggestion)
Seems that I have to write my own ContentHandler to output the XHTML.(?)
My idea is to have a DefaultHandler chained with with a XMLFilterImpl.
The DefaultHandler modifies the XHTML as I want and the chained filter
outputs it.
/roberto
Michael Glavassevich wrote:
> Roberto Cosenza <li...@robcos.com> wrote on 05/22/2006 11:20:26 AM:
>
>> Hi David. Thank you for your clarification.
>> It is clear, SAX is the way to go for me.
>> I confirm that sax is reading the doctype and doing the validation
>> accordingly. It was missleading that the XMLSerializer was outputting
>> the "Strict" doctype unregarding of the input one.
>
> If you're writing new code, I would avoid using Xerces' native
> serializers. They are non-standard, not particularly well maintained and
> likely to be deprecated [1] soon (perhaps in the next release). JAXP's
> TransformerHandler [2] is a much better choice for serializing SAX events.
>
>> I have one more question:
>> Parsing a document which contains the fragment
>> <a href="mylink.html" >mylink</a>, generates events also for the
>> a-attribute 'shape="rect"', which is not given in input!!
>> Is there any way to turn this behavior off? It seems like the parser is
>> inserting some implicit attributes here and there...
>> /Roberto
>
> [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6
> [2]
> http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/sax/TransformerHandler.html
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
--
Roberto Cosenza
ICQ 12231605, MSN & Jabber robcos AT robcos.com
Tel: +46-(0)70-4660928
Work Tel: +46-(0)8-55576860, Fax: +46-(0)8-55576861
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org