At 15.07 19/12/2005 -0200, Darlan Vivian wrote:
Alberto,

I'm using Xerces-c 2.7.0.
The "correct" result that I need is this:

<protocol>
    <command/>
</protocol>

Best Regards.

Darlan,
I created this XML fragment:

<protocol>
    <command></command>
</protocol>

then I ran "domprint c:\test_domwriter.xml" from the bin directory of a binary distribution of Xerces 2.7 and I got this:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><protocol>
    <command/>
</protocol>

Now, the only reason why you are getting something different is that the <command> element has at least one child node (maybe just a text node with no content). Please check how you are creating the DOM tree you are serialing.

Also, please use [email protected] instead of sending the e-mail directly to me; this way you multiply the chances of getting a useful answer, and the answer at the same time helps several other users.

Alberto



----- Original Message ----- From: "Alberto Massari" <[EMAIL PROTECTED]>
To: "Darlan Vivian" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Monday, December 19, 2005 2:43 PM
Subject: Re: xerces-c DOMWriter


At 14.35 19/12/2005 -0200, Darlan Vivian wrote:
Hi Alberto,

I'm using the method writeToString() to serialize a DOMDocument.
The result is like this:

<protocol>
    <command>printf</command>
</protocol>

But when the command tag is empty, i need that the result is the following:

<protocol>
    </command>
</protocol>

I hope you meant <command/>... Anyhow, this is
the behavior I see in the code for DOMWriter in Xerces 2.7

            DOMNodeSPtr child = nodeToWrite->getFirstChild();
            if (child != 0)
            [...]
            else
            [...]
               *fFormatter <<
XMLFormatter::NoEscapes << chForwardSlash << chCloseAngle;

Which version of Xerces are you using?

Alberto

Exists some way that the DOMWriter makes this?

Best regards,

_______________________________
Darlan Vivian

<http://www.bry.com.br>www.bry.com.br
Rua Lauro Linhares, 2123 Torre B Sl.306
88036-002 - Florianópolis - SC - Brasil
Fone/Fax: (48) 234-6696 ramal 225

BRy Tecnologia - Confiança no uso de documentos eletrônicos.
Para adquirir seu certificado digital <https://www2.bry.com.br/loja/produtos.asp?COD_GRUPO=1>clique aqui. <http://www.bry.com.br/produtos/signer/default.asp>Clique e conheça o mais completo software para assinatura digital.



Reply via email to