Hi there again,

I'm still stuck with my problem... This time, I used the Alberto code, which
would be : 

_________________________________________________________________________________
XMLCh tempStr[100];  
XMLString::transcode("LS", tempStr, 99);  
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(tempStr);  
DOMLSSerializer* theSerializer =
((DOMImplementationLS*)impl)->createLSSerializer(); 
DOMLSOutput* theOutput = ((DOMImplementationLS*)impl)->createLSOutput(); 
XMLString::transcode(path, tempStr, 99);  
theOutput->setSystemId(tempStr);
XMLString::transcode("ISO-8859-1", tempStr, 99);  
theOutput->setEncoding(tempStr);

try  {      
   theSerializer->write(node, theOutput);  } 
_________________________________________________________________________________


I perfectly works to write into a file...
But I would like the get the XML content as an char* stream.
The thing is (I surely missed something...), the DOMLSOutput class only
implements a getByteStream method, which returns a XMLFormatTarget object. 
But the getRawBuffer(), which returns a XMLByte* stream is only implemented
in the MemBufFormatTarget... 
I can't use the writeToString method since the stream returned has an
"UTF16" encoding (which is logical because the writeToString method does not
need the DOMLSOutput object in which I used the setEncoding method, if you
still follow me ^^)...

So, in a few words (haha nice one after all the crap above : p) : how can I
return a char* stream that would have an encoding set to "ISO-8859-1" (using
the DOMLSOutput I guess)...

Thanks a lot... again : )


radada wrote:
> 
> OKi doki, I'll try that tomorrow at work.
> Thanks a lot for your precious help Alberto : )
> 
> 
> Alberto Massari wrote:
>> 
>> writeToURI is simply a shorthand for creating a DOMLSOutput, calling 
>> setSystemId on it, and invoking write().
>> Just add the setSystemId call to your code, and change writeToURI into 
>> write().
>> 
>> Alberto
>> 
>> 
>> radada wrote:
>>> Lol I just saw that I wans't using the DOMLSOutput because I used the
>>> writeToUri method...
>>> Back to square one : how can I do it? Using write method and then get
>>> the
>>> string back with another method?
>>> Thx...
>>>
>>>
>>> radada wrote:
>>>   
>>>> Hi and thx
>>>>
>>>> here is the code for the serialisation :
>>>>
>>>>    XMLCh tempStr[100];
>>>>    XMLString::transcode("LS", tempStr, 99);
>>>>    DOMImplementation *impl =
>>>> DOMImplementationRegistry::getDOMImplementation(tempStr);
>>>>    DOMLSSerializer* theSerializer =
>>>> ((DOMImplementationLS*)impl)->createLSSerializer();
>>>>
>>>>    DOMLSOutput* theOutput =
>>>> ((DOMImplementationLS*)impl)->createLSOutput();
>>>>    theOutput->setEncoding((XMLCh *)"ISO-8859-1");
>>>>
>>>>    try
>>>>    {
>>>>       theSerializer->writeToURI(node, XMLString::transcode(path));
>>>>    }
>>>>
>>>>
>>>> I'll try with the XMLString::transcode to check...
>>>>
>>>>
>>>>
>>>> Alberto Massari wrote:
>>>>     
>>>>> First of all, you cannot simply cast a char* to be a XMLCh*, but you 
>>>>> need to convert it using XMLString::transcode (and releasing the
>>>>> string 
>>>>> after that). Then, how are you serializing the document?
>>>>>
>>>>> Alberto
>>>>>
>>>>> radada wrote:
>>>>>       
>>>>>> Hi Alberto and thx again for answering : )
>>>>>>
>>>>>> I tried to do it using this code : 
>>>>>>
>>>>>> DOMLSOutput* theOutput =
>>>>>> ((DOMImplementationLS*)impl)->createLSOutput();
>>>>>> theOutput->setEncoding((XMLCh *)"ISO-8859-1");
>>>>>>
>>>>>> but the XML files declaration stil was <?xml version="1.0"
>>>>>> encoding="UTF-8"
>>>>>> standalone="no" ?>. How's that?
>>>>>> Thx again for your help.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Alberto Massari wrote:
>>>>>>   
>>>>>>         
>>>>>>> In the DOML3 specifications, the encoding is set in the DOMLSOutput 
>>>>>>> object that is passed to DOMLSSerializer::write.
>>>>>>>
>>>>>>> Alberto
>>>>>>>
>>>>>>> radada wrote:
>>>>>>>     
>>>>>>>           
>>>>>>>> Hi there again  : ))
>>>>>>>>
>>>>>>>> I've been searching on how to set the XML encoding of the XML
>>>>>>>> declaration
>>>>>>>> output file in xerces 3.0 (C++)
>>>>>>>> In the previous versions, I had to call the setEncoding method of
>>>>>>>> the
>>>>>>>> DOMDocument, but I can't find it now.
>>>>>>>> As a result, the XML files have the "UTF-8" encoding in the
>>>>>>>> declaration
>>>>>>>> while I need them to be in "ISO-8859-1".
>>>>>>>>
>>>>>>>> Thx a lot guys.
>>>>>>>>   
>>>>>>>>       
>>>>>>>>             
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Specifying-XML-Encoding-tp23195708p23312191.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]

Reply via email to