On Tue, Mar 11, 2008 at 7:13 PM, Michael Glavassevich
<[EMAIL PROTECTED]> wrote:
> Hi Daniel,
>
>  "Daniel Yokomizo" <[EMAIL PROTECTED]> 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.
>
>  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

LexicalHandler solved most of my problems. The only issue I still have
is getting the xml declaration info (e.g. version, encoding) but right
now I can just ignore it.

Thanks for your help.

>  Michael Glavassevich
>  XML Parser Development
>  IBM Toronto Lab
>  E-mail: [EMAIL PROTECTED]
>  E-mail: [EMAIL PROTECTED]

Daniel Yokomizo.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to