j-users@xerces.apache.org
[Top] [All Lists]

Re: Accessing xml and doctype declaration via SAX

Subject: Re: Accessing xml and doctype declaration via SAX
From: Michael Glavassevich
Date: Tue, 11 Mar 2008 18:13:10 -0400
Hi Daniel,

"Daniel Yokomizo" <daniel.yokomizo@xxxxxxxxx> wrote on 03/11/2008 05:31:53
PM:

> Hi,
>
>     I'm writing a xml based template (I have some reasons to not use
> XSLT for this) and I'm using SAX to parse the template source and
> create the AST that will eventually be executed and create the
> resulting xml. The template may declare the doctype and xml, so I
> would like to make the AST just copy such information from the source
> as is to the target. Also, as the template language has it's own
> elements and attributes the template document may not conform to the
> declared DTD, so I need to use setValidating(false). Reading the
> feature list I found nothing (AFAICS) to solve this problem. How can I
> do it?
>     To make the problem simpler I tried to create a handler that would
> just write to a stream the data received from the document, but the
> DTDHandler callbacks were never called. It's possible to use SAX to
> just copy a document, without missing any information? With this
> solution I could hack something to fit my needs.

Most DTD events are reported to DeclHandler [1] and LexicalHandler [2].
DTDHandler only notifies you of notations and unparsed entity declarations.

>     Best regards,
>     Daniel Yokomizo.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/DeclHandler.html
[2]
http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/LexicalHandler.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>