You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Thomas Porschberg <th...@osp-dd.de> on 2002/07/17 11:57:04 UTC

print a DOMDocument from memory

I built a DOMDocument in memory like in CreateDOMDocument-sample.
Now I want print it and I looked at DOMPrint.cpp.
There the parser object XercesDOMParser use the parse method with a file.
How can I hand over my DOMDocument the parser method ?
I think I have to create a DOMInputSourceWrapper or a MemBufInputSource.
Is there any example available ?

thomas

-- 

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


RE: print a DOMDocument from memory

Posted by Evert Haasdijk <ev...@zukkespijkers.nl>.
Thomas,

No, the creation of a DOMDocument and its children is not checked against
any DTD - if you want to verify, your only option is to write the document
and read it back in with a parser - cumbersome, but there you have it.
Also, see Jesse's mail in this thread.

Regards,

Evert


> -----Original Message-----
> From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> Sent: Wednesday, July 17, 2002 2:06 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: print a DOMDocument from memory
>
>
> Exactly:
>
> the future:
> ==========
> I have a application that hold some data. From this data I want to
> build a XML-Stream(via a DOMTree) and send it to a servlet(via
> curl-library).
> Before I send this data I will verify, that the data sufficient a DTD.
> So I thought I have to parse the XML I built in memory.
>
> reality:
> =======
> My first step was now to build a document and to print it.
> I did it with:
>
>  DOMNode   *my_doc = doc->getDocumentElement();
>  theSerializer->writeNode(myFormTarget, *my_doc);
>
> So, do you mean I have not to validate after building the DOMTree
> because I will get a error/exception on building if I offend
> against a rule made
> by the DTD?
>
> PS: your comments really helped me.
>
> On Wed, Jul 17, 2002 at 01:40:56PM +0200, Evert Haasdijk wrote:
> > What do you want to do? Do you want to write the document to
> stdout or do
> > you want to validate it?
> >
> > AFAIK, you can't validate an in-memory document directly - you
> can write it
> > to some (temporary) file and parse that.
> >
> > If you just want to write the document, use the DOMNode that
> you've created
> > as your document's root in stead of the on returned by the parser in the
> > exaxmple.
> >
> > HTH Evert
> >
> > > -----Original Message-----
> > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > Sent: Wednesday, July 17, 2002 1:29 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: Re: print a DOMDocument from memory
> > >
> > >
> > > to validate afterwards against a external DTD?!
> > >
> > > On Wed, Jul 17, 2002 at 01:20:43PM +0200, Evert Haasdijk wrote:
> > > > Ehmm...I don't quite see - why  do you need a parser? If you've
> > > created the
> > > > DOMDocument from scratch, you can surely get to it's root node,
> > > can't you?
> > > >
> > > > > -----Original Message-----
> > > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > > Sent: Wednesday, July 17, 2002 1:10 PM
> > > > > To: xerces-c-dev@xml.apache.org
> > > > > Subject: Re: print a DOMDocument from memory
> > > > >
> > > > >
> > > > > Thanks for this code, it's really not so simple.
> > > > >
> > > > > I thought I can use this way(from DOMPrint.cpp):
> > > > >
> > > > > 			StdOutFormatTarget *myFormTarget = new
> > > > > StdOutFormatTarget();
> > > > >
> > > > > 			// get the DOM representation
> > > > > 			DOMNode                     *doc =
> > > > > parser->getDocument();
> > > > >
> > > > > 			//
> > > > > 			// do the serialization through
> > > > > DOMWriter::writeNode();
> > > > > 			//
> > > > >
> theSerializer->writeNode(myFormTarget, *doc);
> > > > >
> > > > > For this I would need a parser instance which contains
> the document.
> > > > > But is it really so hard to feed this XercesDOMParser with a
> > > DOMDocument ?
> > > > >
> > > > > thomas
> > > > >
> > > > > On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> > > > > > Thomas,
> > > > > >
> > > > > > I've written a class (borrowing heavily from the DOMPrint
> > > > > example) to write
> > > > > > in-memory DOMDocuments to any ostream.
> > > > > >
> > > > > > Feel free:
> > > > > >
> > > > > > http://www.xs4all.nl/~ewh/DOMSerializer/
> > > > > >
> > > > > >
> > > > > > Ta, Evert
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > > > > Sent: Wednesday, July 17, 2002 11:57 AM
> > > > > > > To: xerces-c-dev@xml.apache.org
> > > > > > > Subject: print a DOMDocument from memory
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > I built a DOMDocument in memory like in
> CreateDOMDocument-sample.
> > > > > > > Now I want print it and I looked at DOMPrint.cpp.
> > > > > > > There the parser object XercesDOMParser use the parse method
> > > > > with a file.
> > > > > > > How can I hand over my DOMDocument the parser method ?
> > > > > > > I think I have to create a DOMInputSourceWrapper or a
> > > > > MemBufInputSource.
> > > > > > > Is there any example available ?
> > > > > > >
> > > > > > > thomas
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> > > > > > > For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > > > For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> > > > >
> > > > > --
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > > --
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>



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


Re: print a DOMDocument from memory

Posted by Thomas Porschberg <th...@osp-dd.de>.
Exactly:

the future:
==========
I have a application that hold some data. From this data I want to
build a XML-Stream(via a DOMTree) and send it to a servlet(via curl-library).
Before I send this data I will verify, that the data sufficient a DTD.
So I thought I have to parse the XML I built in memory.

reality:
=======
My first step was now to build a document and to print it.
I did it with:

 DOMNode   *my_doc = doc->getDocumentElement();
 theSerializer->writeNode(myFormTarget, *my_doc);

So, do you mean I have not to validate after building the DOMTree
because I will get a error/exception on building if I offend against a rule made
by the DTD?

PS: your comments really helped me.

On Wed, Jul 17, 2002 at 01:40:56PM +0200, Evert Haasdijk wrote:
> What do you want to do? Do you want to write the document to stdout or do
> you want to validate it?
> 
> AFAIK, you can't validate an in-memory document directly - you can write it
> to some (temporary) file and parse that.
> 
> If you just want to write the document, use the DOMNode that you've created
> as your document's root in stead of the on returned by the parser in the
> exaxmple.
> 
> HTH Evert
> 
> > -----Original Message-----
> > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > Sent: Wednesday, July 17, 2002 1:29 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: Re: print a DOMDocument from memory
> >
> >
> > to validate afterwards against a external DTD?!
> >
> > On Wed, Jul 17, 2002 at 01:20:43PM +0200, Evert Haasdijk wrote:
> > > Ehmm...I don't quite see - why  do you need a parser? If you've
> > created the
> > > DOMDocument from scratch, you can surely get to it's root node,
> > can't you?
> > >
> > > > -----Original Message-----
> > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > Sent: Wednesday, July 17, 2002 1:10 PM
> > > > To: xerces-c-dev@xml.apache.org
> > > > Subject: Re: print a DOMDocument from memory
> > > >
> > > >
> > > > Thanks for this code, it's really not so simple.
> > > >
> > > > I thought I can use this way(from DOMPrint.cpp):
> > > >
> > > > 			StdOutFormatTarget *myFormTarget = new
> > > > StdOutFormatTarget();
> > > >
> > > > 			// get the DOM representation
> > > > 			DOMNode                     *doc =
> > > > parser->getDocument();
> > > >
> > > > 			//
> > > > 			// do the serialization through
> > > > DOMWriter::writeNode();
> > > > 			//
> > > > 			theSerializer->writeNode(myFormTarget, *doc);
> > > >
> > > > For this I would need a parser instance which contains the document.
> > > > But is it really so hard to feed this XercesDOMParser with a
> > DOMDocument ?
> > > >
> > > > thomas
> > > >
> > > > On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> > > > > Thomas,
> > > > >
> > > > > I've written a class (borrowing heavily from the DOMPrint
> > > > example) to write
> > > > > in-memory DOMDocuments to any ostream.
> > > > >
> > > > > Feel free:
> > > > >
> > > > > http://www.xs4all.nl/~ewh/DOMSerializer/
> > > > >
> > > > >
> > > > > Ta, Evert
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > > > Sent: Wednesday, July 17, 2002 11:57 AM
> > > > > > To: xerces-c-dev@xml.apache.org
> > > > > > Subject: print a DOMDocument from memory
> > > > > >
> > > > > >
> > > > > >
> > > > > > I built a DOMDocument in memory like in CreateDOMDocument-sample.
> > > > > > Now I want print it and I looked at DOMPrint.cpp.
> > > > > > There the parser object XercesDOMParser use the parse method
> > > > with a file.
> > > > > > How can I hand over my DOMDocument the parser method ?
> > > > > > I think I have to create a DOMInputSourceWrapper or a
> > > > MemBufInputSource.
> > > > > > Is there any example available ?
> > > > > >
> > > > > > thomas
> > > > > >
> > > > > > --
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > >
> > > > --
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > --
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

-- 

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


RE: print a DOMDocument from memory

Posted by Evert Haasdijk <ev...@zukkespijkers.nl>.
What do you want to do? Do you want to write the document to stdout or do
you want to validate it?

AFAIK, you can't validate an in-memory document directly - you can write it
to some (temporary) file and parse that.

If you just want to write the document, use the DOMNode that you've created
as your document's root in stead of the on returned by the parser in the
exaxmple.

HTH Evert

> -----Original Message-----
> From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> Sent: Wednesday, July 17, 2002 1:29 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: print a DOMDocument from memory
>
>
> to validate afterwards against a external DTD?!
>
> On Wed, Jul 17, 2002 at 01:20:43PM +0200, Evert Haasdijk wrote:
> > Ehmm...I don't quite see - why  do you need a parser? If you've
> created the
> > DOMDocument from scratch, you can surely get to it's root node,
> can't you?
> >
> > > -----Original Message-----
> > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > Sent: Wednesday, July 17, 2002 1:10 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: Re: print a DOMDocument from memory
> > >
> > >
> > > Thanks for this code, it's really not so simple.
> > >
> > > I thought I can use this way(from DOMPrint.cpp):
> > >
> > > 			StdOutFormatTarget *myFormTarget = new
> > > StdOutFormatTarget();
> > >
> > > 			// get the DOM representation
> > > 			DOMNode                     *doc =
> > > parser->getDocument();
> > >
> > > 			//
> > > 			// do the serialization through
> > > DOMWriter::writeNode();
> > > 			//
> > > 			theSerializer->writeNode(myFormTarget, *doc);
> > >
> > > For this I would need a parser instance which contains the document.
> > > But is it really so hard to feed this XercesDOMParser with a
> DOMDocument ?
> > >
> > > thomas
> > >
> > > On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> > > > Thomas,
> > > >
> > > > I've written a class (borrowing heavily from the DOMPrint
> > > example) to write
> > > > in-memory DOMDocuments to any ostream.
> > > >
> > > > Feel free:
> > > >
> > > > http://www.xs4all.nl/~ewh/DOMSerializer/
> > > >
> > > >
> > > > Ta, Evert
> > > >
> > > > > -----Original Message-----
> > > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > > Sent: Wednesday, July 17, 2002 11:57 AM
> > > > > To: xerces-c-dev@xml.apache.org
> > > > > Subject: print a DOMDocument from memory
> > > > >
> > > > >
> > > > >
> > > > > I built a DOMDocument in memory like in CreateDOMDocument-sample.
> > > > > Now I want print it and I looked at DOMPrint.cpp.
> > > > > There the parser object XercesDOMParser use the parse method
> > > with a file.
> > > > > How can I hand over my DOMDocument the parser method ?
> > > > > I think I have to create a DOMInputSourceWrapper or a
> > > MemBufInputSource.
> > > > > Is there any example available ?
> > > > >
> > > > > thomas
> > > > >
> > > > > --
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > > --
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>



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


Re: print a DOMDocument from memory

Posted by Thomas Porschberg <th...@osp-dd.de>.
to validate afterwards against a external DTD?!

On Wed, Jul 17, 2002 at 01:20:43PM +0200, Evert Haasdijk wrote:
> Ehmm...I don't quite see - why  do you need a parser? If you've created the
> DOMDocument from scratch, you can surely get to it's root node, can't you?
> 
> > -----Original Message-----
> > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > Sent: Wednesday, July 17, 2002 1:10 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: Re: print a DOMDocument from memory
> >
> >
> > Thanks for this code, it's really not so simple.
> >
> > I thought I can use this way(from DOMPrint.cpp):
> >
> > 			StdOutFormatTarget *myFormTarget = new
> > StdOutFormatTarget();
> >
> > 			// get the DOM representation
> > 			DOMNode                     *doc =
> > parser->getDocument();
> >
> > 			//
> > 			// do the serialization through
> > DOMWriter::writeNode();
> > 			//
> > 			theSerializer->writeNode(myFormTarget, *doc);
> >
> > For this I would need a parser instance which contains the document.
> > But is it really so hard to feed this XercesDOMParser with a DOMDocument ?
> >
> > thomas
> >
> > On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> > > Thomas,
> > >
> > > I've written a class (borrowing heavily from the DOMPrint
> > example) to write
> > > in-memory DOMDocuments to any ostream.
> > >
> > > Feel free:
> > >
> > > http://www.xs4all.nl/~ewh/DOMSerializer/
> > >
> > >
> > > Ta, Evert
> > >
> > > > -----Original Message-----
> > > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > > Sent: Wednesday, July 17, 2002 11:57 AM
> > > > To: xerces-c-dev@xml.apache.org
> > > > Subject: print a DOMDocument from memory
> > > >
> > > >
> > > >
> > > > I built a DOMDocument in memory like in CreateDOMDocument-sample.
> > > > Now I want print it and I looked at DOMPrint.cpp.
> > > > There the parser object XercesDOMParser use the parse method
> > with a file.
> > > > How can I hand over my DOMDocument the parser method ?
> > > > I think I have to create a DOMInputSourceWrapper or a
> > MemBufInputSource.
> > > > Is there any example available ?
> > > >
> > > > thomas
> > > >
> > > > --
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > --
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

-- 

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


RE: print a DOMDocument from memory

Posted by Evert Haasdijk <ev...@zukkespijkers.nl>.
Ehmm...I don't quite see - why  do you need a parser? If you've created the
DOMDocument from scratch, you can surely get to it's root node, can't you?

> -----Original Message-----
> From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> Sent: Wednesday, July 17, 2002 1:10 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Re: print a DOMDocument from memory
>
>
> Thanks for this code, it's really not so simple.
>
> I thought I can use this way(from DOMPrint.cpp):
>
> 			StdOutFormatTarget *myFormTarget = new
> StdOutFormatTarget();
>
> 			// get the DOM representation
> 			DOMNode                     *doc =
> parser->getDocument();
>
> 			//
> 			// do the serialization through
> DOMWriter::writeNode();
> 			//
> 			theSerializer->writeNode(myFormTarget, *doc);
>
> For this I would need a parser instance which contains the document.
> But is it really so hard to feed this XercesDOMParser with a DOMDocument ?
>
> thomas
>
> On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> > Thomas,
> >
> > I've written a class (borrowing heavily from the DOMPrint
> example) to write
> > in-memory DOMDocuments to any ostream.
> >
> > Feel free:
> >
> > http://www.xs4all.nl/~ewh/DOMSerializer/
> >
> >
> > Ta, Evert
> >
> > > -----Original Message-----
> > > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > > Sent: Wednesday, July 17, 2002 11:57 AM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: print a DOMDocument from memory
> > >
> > >
> > >
> > > I built a DOMDocument in memory like in CreateDOMDocument-sample.
> > > Now I want print it and I looked at DOMPrint.cpp.
> > > There the parser object XercesDOMParser use the parse method
> with a file.
> > > How can I hand over my DOMDocument the parser method ?
> > > I think I have to create a DOMInputSourceWrapper or a
> MemBufInputSource.
> > > Is there any example available ?
> > >
> > > thomas
> > >
> > > --
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>



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


Re: print a DOMDocument from memory

Posted by Thomas Porschberg <th...@osp-dd.de>.
Thanks for this code, it's really not so simple.

I thought I can use this way(from DOMPrint.cpp):

			StdOutFormatTarget *myFormTarget = new StdOutFormatTarget();

			// get the DOM representation
			DOMNode                     *doc = parser->getDocument();

			//
			// do the serialization through DOMWriter::writeNode();
			//
			theSerializer->writeNode(myFormTarget, *doc);

For this I would need a parser instance which contains the document.
But is it really so hard to feed this XercesDOMParser with a DOMDocument ?

thomas

On Wed, Jul 17, 2002 at 12:31:49PM +0200, Evert Haasdijk wrote:
> Thomas,
> 
> I've written a class (borrowing heavily from the DOMPrint example) to write
> in-memory DOMDocuments to any ostream.
> 
> Feel free:
> 
> http://www.xs4all.nl/~ewh/DOMSerializer/
> 
> 
> Ta, Evert
> 
> > -----Original Message-----
> > From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> > Sent: Wednesday, July 17, 2002 11:57 AM
> > To: xerces-c-dev@xml.apache.org
> > Subject: print a DOMDocument from memory
> >
> >
> >
> > I built a DOMDocument in memory like in CreateDOMDocument-sample.
> > Now I want print it and I looked at DOMPrint.cpp.
> > There the parser object XercesDOMParser use the parse method with a file.
> > How can I hand over my DOMDocument the parser method ?
> > I think I have to create a DOMInputSourceWrapper or a MemBufInputSource.
> > Is there any example available ?
> >
> > thomas
> >
> > --
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

-- 

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


RE: print a DOMDocument from memory

Posted by Evert Haasdijk <ev...@zukkespijkers.nl>.
Thomas,

I've written a class (borrowing heavily from the DOMPrint example) to write
in-memory DOMDocuments to any ostream.

Feel free:

http://www.xs4all.nl/~ewh/DOMSerializer/


Ta, Evert

> -----Original Message-----
> From: Thomas Porschberg [mailto:thomas.porschberg@osp-dd.de]
> Sent: Wednesday, July 17, 2002 11:57 AM
> To: xerces-c-dev@xml.apache.org
> Subject: print a DOMDocument from memory
>
>
>
> I built a DOMDocument in memory like in CreateDOMDocument-sample.
> Now I want print it and I looked at DOMPrint.cpp.
> There the parser object XercesDOMParser use the parse method with a file.
> How can I hand over my DOMDocument the parser method ?
> I think I have to create a DOMInputSourceWrapper or a MemBufInputSource.
> Is there any example available ?
>
> thomas
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>



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