Thanks Dave, but the output of my writer is producing a space between the
tag name and the name of the attribute. How can I stop that. Here is a code
snippet.

      XMLPlatformUtils::Initialize();
      DOMImplementation * impl =
DOMImplementationRegistry::getDOMImplementation(X("Core"));
      m_xmlDoc = impl->createDocument(0, X("Transaction"), 0);
      m_xmlDoc->setEncoding(X("UTF-8"));
      m_rootElem = m_xmlDoc->getDocumentElement();

      DOMElement * submitionElem = m_xmlDoc->createElement(X("Submission"));
      m_rootElem->appendChild(submitionElem);
     submitionElem->setAttribute(X("Number"),
X(sub_struct.attrNumber.c_str()));

         XMLCh tempStr[100];
         XMLString::transcode("LS", tempStr, 99);
         DOMImplementation *impl          =
DOMImplementationRegistry::getDOMImplementation(tempStr);
         DOMWriter         *theSerializer =
((DOMImplementationLS*)impl)->createDOMWriter();
         theSerializer->setFeature(X("whitespace-in-element-content"),
true);

         XMLCh * result = theSerializer->writeToString(*m_xmlDoc);
        string resultStr =  XMLString::transcode(result);

This is the ouputs
<Transation>
    <Submition Number="1"></Submition>
</Transaction>

----- Original Message -----
From: "David N Bertoni/Cambridge/IBM" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 3:00 PM
Subject: Re: Spaces in tag


>
>
>
>
> The space in your example is not part of the tag name, rather, it
separates
> the tag name from the name of the attribute.  Since tag names cannot
> contain spaces, you should never have to replace them.
>
> Dave
>
>
>
>
>                       "Nash Kabbara"
>                       <[EMAIL PROTECTED]>         To:
<[EMAIL PROTECTED]>
>                                                cc:      (bcc: David N
Bertoni/Cambridge/IBM)
>                       01/02/2003 12:57         Subject: Spaces in tag
>                       PM
>                       Please respond
>                       to xerces-c-dev
>
>
>
>
> Hi,
>     How can I replace spaces in tags with %20? for e.g.
>
> <root>
>     <elem1 attr="bla"></elem1>
> </root>
>
> TO
>
> <root>
>     <elem1%20attr="bla"></elem1>
> </root>
>
> I am using the DOM implementation.
> Thank you,
> Nash
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to