Hi,
On 27 Apr 2010, at 07:49, nishank837 wrote:
>
> Well actually this is how I am doing it
>
> pImplement =
> DOMImplementationRegistry::getDOMImplementation(XMLString::transcode("LS"));
> Serializer = ((DOMImplementationLS*)pImplement)->createDOMWriter();
> XMLFormatTarget *myFormatTarget = new MemBufFormatTarget();
> Serializer->writeNode(myFormatTarget, *XDOMDocument);
> XMLObject = (char*)((MemBufFormatTarget*)myFormatTarget)->getRawBuffer();
>
> I totally forgot to mention one thing.....I have stored this XML as and
> attribute to another XML tag ....will that work?? Is it possible to retrieve
> the attribute with the original formatting
>
You might want to make sure you really want to do what you are doing. What you
have in the attribute value is a text node. Its not parsed into different DOM
Nodes and it seems a touch strange that you would want to store XML there. The
parser will not make sure its correct XML (apart from the fact its a valid
attribute). For your problem, take a look at setNewLine on DOMLSSerializer.
http://xerces.apache.org/xerces-c/apiDocs-3/classDOMLSSerializer.html#56882d2fe0b4a0ecb1b3968febbcf4a3
Does this fix it?
Gareth
> Gareth Reakes-6 wrote:
>>
>> Hi,
>>
>> On 26 Apr 2010, at 18:36, nishank837 wrote:
>>
>>>
>>> Hi,
>>> I am having problems handling white space etc while parsing XML
>>> documents.
>>> The data I want to be saved is somethign like this which include line
>>> feeds
>>> and white spaces
>>> <info>
>>> <label>ABB</label>
>>> <description>Please</description>
>>> </info>
>>>
>>> <question id="TEacher" xsi:type="options">
>>>
>>> when I save this xml and parse it and get it i get something like this
>>> <info> <label>ABB</label>
>>> <description>Please</description></info><question id="TEacher"
>>> xsi:type="options">
>>> with all the line feeds stripped of.....Can someone let me know how I can
>>> retain all these?
>>
>>
>> When you say this happens after you parse the document, how do you tell?
>> How are you serialising to the second document that does not have the new
>> lines in?
>>
>> Gareth
>>
>>
>>
>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Problems-with-White-Space-and-Line-Feed-Handling-tp28367855p28367855.html
>>> Sent from the Xerces - C - Dev mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> --
>> Gareth Reakes, CTO WE7 - Great Music, Free
>> +44-20-7117-0809 http://www.we7.com
>>
>>
>>
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/Problems-with-White-Space-and-Line-Feed-Handling-tp28367855p28373515.html
> Sent from the Xerces - C - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Gareth Reakes, CTO WE7 - Great Music, Free
+44-20-7117-0809 http://www.we7.com