#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    138
    Rep Power
    12

    Creating CDATA Section using Dom Class


    Hi All,
    I am trying to create a CDATA section using the Dom class but am not been able to find out the syntax for the same. I tried just using plain CString for this purpose but it does not do the work for me. Can anyone please suggest the syntax for the same.
    I am using Embedded Visual C++ 3.0.
    Thank you in advance
    Raghu
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    138
    Rep Power
    12
    Thank you all whoever tried working on my problem. I got it working by using the dom class and writing a new method in my dom class
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    138
    Rep Power
    12
    Was Thinking maybe putting the code i wrote might help . Hope it is helpful
    PHP Code:
    IXMLDOMNode *CXMLDOMDoc::CreateCData(IXMLDOMNodenodeLPCTSTR nodeNameLPCTSTR nodeValue)
    {
        if(!
    mpDoc) return NULL;
        
    IXMLDOMCDATASection *cdata;
        
    IXMLDOMNode *newNode;
        
    //Create a new node with required node name
        
    HRESULT hr mpDoc->createElement((BSTR)nodeName,(IXMLDOMElement**)&newNode);
        if(
    hr) return NULL;
        
    hr mpDoc->createCDATASection((BSTR)nodeValue,&cdata); //This is the msxml call to create a cdata section
        
    if(hr) return NULL;
        
    //Append a child node for the parent base node.
        
    hr node->appendChild(newNode,&newNode);
        if(
    hr) return NULL;
        
    //Append the cdata created to the new node for the total building of the xml
        
    hr newNode->appendChild((IXMLDOMNode*)cdata,&newNode);
        if(
    hr) return NULL;
        return 
    newNode;

    Last edited by Raghuraman; July 30th, 2003 at 12:10 PM.

IMN logo majestic logo threadwatch logo seochat tools logo