Thanks 

This The Code

void CreaXML( CString strValue,CString strFile)  
{
        XMLCh m_xmlChTempStr[400];
        XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* m_xmlDoc;
        DOMImplementation *m_xmlImpl;
        XMLCh tempStr[400];

        XMLPlatformUtils::Initialize();

        XMLString::transcode("LS", m_xmlChTempStr, (400));
        m_xmlImpl =
DOMImplementationRegistry::getDOMImplementation(m_xmlChTempStr);
        
        CString root = "Contents";
        XMLString::transcode(root, m_xmlChTempStr, (400));
        m_xmlDoc = m_xmlImpl->createDocument(0, m_xmlChTempStr, 0);
    DOMElement* Contents = m_xmlDoc->getDocumentElement();
        
        XMLString::transcode("version", m_xmlChTempStr, (400 ));
        XMLString::transcode(VERSIO_XML_REC_CMD, tempStr, (400));
        DOMAttr* attr = m_xmlDoc->createAttribute(m_xmlChTempStr);
        attr->setValue(tempStr);
        Contents->setAttributeNode(attr);

        XMLString::transcode( m_strValue, m_xmlChTempStr, (400));
        
        try
        {
                DOMWriter *theSerializer =
((DOMImplementationLS*)m_xmlImpl)->createDOMWriter();

                //Opcional. activem (Set) el nostre propi errorHandler
                DOMErrorHandler *errorHandler = new DOMCountErrorHandler();
                theSerializer->setErrorHandler(errorHandler);

        //Opcional. set feature to serializer 
        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);

                // creem un "Format target" per rebre el xml creat pel 
serialtzador 
        // StdOutFormatTarget dibuixa el xml resultant q rep del
serialitzador
                XMLFormatTarget *FormTarget = new 
LocalFileFormatTarget(m_strFile);

                // serialitzem amb DOMWriter::writeNode()
                
                theSerializer->writeNode(FormTarget, *m_xmlDoc);
                
            // std::ios_base::out est automatiquement ajouté par le
    // constructeur de std::ofstream

                theSerializer->release();
                delete errorHandler;
                delete FormTarget;

        }
        catch (const OutOfMemoryException& /*e*/)
    {
                
        }
    catch (const XMLException& /*e*/)
    {
                
    }

        nErrorSuma = nError1 + nError2;
        return nErrorSuma;

        m_xmlDoc->release();
        
}

with

//Value Of strValue =
"<Personne><FirstName>toto</FirstName><LastName>toto</LastName></Personne><Personne><FirstName>tata</FirstName><LastName>tata</LastName></Personne>"


I hops it's more clear now 

:)



Jesse Pelton wrote:
> 
> Just attach the code to a message.  I'd recommend making the simplest
> possible test case out of it first.  This has a couple of advantages:
> first, it's possible that you will find the problem yourself in the course
> of simplifying it, and second, if you do need to ask for help, the simpler
> the code is, the more likely it is that someone will be willing and able
> to help.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Xerces-and-special-caractere-%3C-%3E-tp24201194p24205593.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to