I finally got it! So far, so good. :)
DOMWriter *dw = impl->createDOMWriter();
encNameStr = XMLString::transcode("UTF-8");
dw->setEncoding(encNameStr);
XMLFormatTarget *myFormTarget;
myFormTarget = new MemBufFormatTarget(5000000);
dw->writeNode(myFormTarget, *doc);
const XMLByte* pcBuf;
pcBuf = ((MemBufFormatTarget*)myFormTarget)->getRawBuffer();
unsigned int uiBufLen = ((MemBufFormatTarget*)myFormTarget)->getLen();
strcpy(xml, (char*)pcBuf);
delete dw;
delete myFormTarget;
Best regards,
Milan
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 04, 2003 1:14 PM
> To: [EMAIL PROTECTED]
> Subject: RE: DOMNode to char* conversion
>
>
>
> > take a look at the docs for that method. They state
> > that it always returns UTF-16.
> Thank you. That solved part of the mistery.
>
> > Take a look at wrtieNode.
> Please, could someone help me with this? I've spent another few hours
> playing with it without success. To get result (char*) of my XML
> document (XMLNode) should be peace of the cake and something
> everyone of
> us do every day, not so complicated.
>
> Thank you.
>
>
> > -----Original Message-----
> > From: Gareth Reakes [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, December 03, 2003 12:26 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: DOMNode to char* conversion
> >
> >
> > Hi,
> > take a look at the docs for that method. They state
> > that it always
> > returns UTF-16. Take a look at wrtieNode.
> >
> > Gareth
> >
> >
> >
> > On Wed, 3 Dec 2003, Milan Tomic wrote:
> >
> > >
> > > I've done this:
> > >
> > > DOMWriter *dw = impl->createDOMWriter();
> > > encNameStr = XMLString::transcode("UTF-8");
> > > dw->setEncoding(encNameStr);
> > > XMLCh* xcXML = dw->writeToString(*rootNode);
> > > char *cXML = XMLString::transcode(xcXML);
> > > delete dw;
> > >
> > > but there is "UTF-16" in first line of my document, and
> > there should
> > > be "UTF-8" because document was already UTF-8 encoded:
> > >
> > > <?xml version="1.0" encoding="UTF-16" standalone="no" ?>
> > >
> > > How can I replace "UTF-16" with "UTF-8" here? Because,
> when I save
> > > output chars in file and replace it (16 with 8) in notepad,
> > everything
> > > works fine.
> > >
> > > Thank you,
> > > Milan
> > >
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> > --
> > Gareth Reakes, Head of Product Development +44-1865-203192
> > DecisionSoft Limited
> > http://www.decisionsoft.com
> > XML Development and Services
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]