You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by COCHET Jérôme FTRD/DIH/REN <je...@rd.francetelecom.fr> on 2001/05/15 14:48:22 UTC

Transformation problem using DOM object

Hi,

I use the "javax.xml.parsers.DocumentBuilder" class to create a DOM object
from test.xml, 
I use the "javax.xml.transform.Transformer" class to generate the test.html
file from this DOM
object and from the file test.xsl.
The problem is that when there are entities references in the test.xml file,
they disappear.
When I use directly the test.xml file instead of the DOM object in the
transformation, the entities resolution is OK !

Any idea ?


here is test.xml :
------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

<!DOCTYPE DOC [
<!ELEMENT DOC (ELT)>
<!ELEMENT ELT (#PCDATA)>
<!ENTITY STR_a_name   "John">
]>

<DOC>
	<ELT>Hello &STR_a_name;</ELT>
</DOC>
-------------------------------------------------------------

thanks in advance

Re: Silly Question...

Posted by René Jensen <lu...@tbkol.dk>.
Well a parser, which implements SAX is eventbased (like GUI-components in
Java), and your applications receives events for each starttag, endtag etc.

A DOMparser returns a DOM document which is the Root of an object tree
representing the parsed XML-file.

You can read more about DOM at www.w3.org
I Haven´t used SAX yet, so I don-t know where to find info on that.

René Jensen
lundeman@tbkol.dk
----- Original Message -----
From: "Pavan Seth" <ps...@yahoo.com>
To: <xa...@xml.apache.org>; <xe...@xml.apache.org>
Sent: Tuesday, May 15, 2001 6:44 PM
Subject: Silly Question...


> What is basic difference between DOM and SAX?
>
>
> --- COCHET_Jérôme_FTRD/DIH/REN
> <je...@rd.francetelecom.fr> wrote:
> >
> > Hi,
> >
> > I use the "javax.xml.parsers.DocumentBuilder" class
> > to create a DOM object
> > from test.xml,
> > I use the "javax.xml.transform.Transformer" class to
> > generate the test.html
> > file from this DOM
> > object and from the file test.xsl.
> > The problem is that when there are entities
> > references in the test.xml file,
> > they disappear.
> > When I use directly the test.xml file instead of the
> > DOM object in the
> > transformation, the entities resolution is OK !
> >
> > Any idea ?
> >
> >
> > here is test.xml :
> >
> ------------------------------------------------------------
> > <?xml version="1.0" encoding="ISO-8859-1"
> > standalone="yes"?>
> >
> > <!DOCTYPE DOC [
> > <!ELEMENT DOC (ELT)>
> > <!ELEMENT ELT (#PCDATA)>
> > <!ENTITY STR_a_name   "John">
> > ]>
> >
> > <DOC>
> > <ELT>Hello &STR_a_name;</ELT>
> > </DOC>
> >
> -------------------------------------------------------------
> >
> > thanks in advance
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>


Silly Question...

Posted by Pavan Seth <ps...@yahoo.com>.
What is basic difference between DOM and SAX?


--- COCHET_J�r�me_FTRD/DIH/REN
<je...@rd.francetelecom.fr> wrote:
> 
> Hi,
> 
> I use the "javax.xml.parsers.DocumentBuilder" class
> to create a DOM object
> from test.xml, 
> I use the "javax.xml.transform.Transformer" class to
> generate the test.html
> file from this DOM
> object and from the file test.xsl.
> The problem is that when there are entities
> references in the test.xml file,
> they disappear.
> When I use directly the test.xml file instead of the
> DOM object in the
> transformation, the entities resolution is OK !
> 
> Any idea ?
> 
> 
> here is test.xml :
>
------------------------------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"
> standalone="yes"?>
> 
> <!DOCTYPE DOC [
> <!ELEMENT DOC (ELT)>
> <!ELEMENT ELT (#PCDATA)>
> <!ENTITY STR_a_name   "John">
> ]>
> 
> <DOC>
> 	<ELT>Hello &STR_a_name;</ELT>
> </DOC>
>
-------------------------------------------------------------
> 
> thanks in advance


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Silly Question...

Posted by Pavan Seth <ps...@yahoo.com>.
What is basic difference between DOM and SAX?


--- COCHET_J�r�me_FTRD/DIH/REN
<je...@rd.francetelecom.fr> wrote:
> 
> Hi,
> 
> I use the "javax.xml.parsers.DocumentBuilder" class
> to create a DOM object
> from test.xml, 
> I use the "javax.xml.transform.Transformer" class to
> generate the test.html
> file from this DOM
> object and from the file test.xsl.
> The problem is that when there are entities
> references in the test.xml file,
> they disappear.
> When I use directly the test.xml file instead of the
> DOM object in the
> transformation, the entities resolution is OK !
> 
> Any idea ?
> 
> 
> here is test.xml :
>
------------------------------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"
> standalone="yes"?>
> 
> <!DOCTYPE DOC [
> <!ELEMENT DOC (ELT)>
> <!ELEMENT ELT (#PCDATA)>
> <!ENTITY STR_a_name   "John">
> ]>
> 
> <DOC>
> 	<ELT>Hello &STR_a_name;</ELT>
> </DOC>
>
-------------------------------------------------------------
> 
> thanks in advance


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org