Thanks for responses
now I wrote what I do Exactly
int CMMPCreaXMLRecCmd::CreaXML()
{
try
{
XMLPlatformUtils::Initialize();
}
catch(const XMLException& )
{
}
XMLString::transcode("LS", xmlChTemp, (LENGTH - 1));
xmlImpl = DOMImplementationRegistry::getDOMImplementation(xmlChTemp);
PrepareDocumentTree();
try
{
DOMWriter *theSerializer =
((DOMImplementationLS*)xmlImpl)->createDOMWriter();
DOMErrorHandler *errorHandler = new DOMCountErrorHandler();
theSerializer->setErrorHandler(errorHandler);
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections,
false))
theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections,
false);
if
(theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, false))
theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent,
false);
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true))
theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
true);
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, true))
theSerializer->setFeature(XMLUni::fgDOMWRTBOM, true);
XMLFormatTarget *FormTarget = new
LocalFileFormatTarget(strFile);
theSerializer->writeNode(FormTarget, *xmlDoc);
theSerializer->release();
delete errorHandler;
delete FormTarget;
}
catch (const OutOfMemoryException& /*e*/)
{
}
catch (const XMLException& /*e*/)
{
}
xmlDoc->release();
}
void CMMPCreaXMLRecCmd::DocumentTree()
{
XMLCh tempStr[LENGTH_TEMPORAL_STRING_3];
CString strNomRuta = "MyString";
XMLString::transcode(strNomRuta, xmlChTemp, (LENGTH_TEMPORAL_STRING_3 -
1));
m_xmlDoc = xmlImpl->createDocument(0, xmlChTemp, 0);
DOMElement* MyString = xmlDoc->getDocumentElement();
XMLString::transcode("version", xmlChTemp, (LENGTH_TEMPORAL_STRING_3 -
1));
XMLString::transcode(VERSIO_XML_REC_CMD, tempStr,
(LENGTH_TEMPORAL_STRING_3
- 1));
DOMAttr* attr = xmlDoc->createAttribute(xmlChTemp);
attr->setValue(tempStr);
MyString->setAttributeNode(attr);
XMLString::transcode(strValue, xmlChTemp, (LENGTH_TEMPORAL_STRING_3 -
1));
DOMText* textNode = xmlDoc->createTextNode(xmlChTemp);
MyString->appendChild(textNode);
}
And strValue content is like this
<Personne><FirstName>toto</FirstName><LastName>toto</LastName></Personne><Personne><FirstName>tata</FirstName><LastName>tata</LastName></Personne>
in resultat I want a file Like that
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<MyString version="2.0">
<Personne>
<FirstName>toto</FirstName>
<LastName>toto</LastName>
</Personne>
<Personne>
<FirstName>tata</FirstName>
<LastName>tata</LastName>
</Personne>
</MyString >
So when i transcode this string , the caractere < change to "& l t ;"
there is anu methode to escape the transcoder this caracteres
Sorry for My English :-(
--
View this message in context:
http://www.nabble.com/Xerces-and-special-caractere-%3C-%3E-tp24201194p24203768.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.