locked
Ayuda XML con CDATA ( VB6 ) RRS feed

  • Question

  • Hola, estoy construyendo un mensaje SOAP el cual envió a un WS, necesito ingresar una sección tipo CDATA al XML, lo cual ya lo realizo pero esta sección se anida como un nodo hijo del nodo elemento. Anexo código para ver si me pueden decir en que estoy mal, necesito agregar un XML en una sección CDATA ya que si paso el valor como texto del nodo elemento se formatea con las funciones de escape y el WS me indica que mi XML esta mal formado por que lleva los caracteres de escape.

    Código VB 6:

     
       Dim objDom As New MSXML2.DOMDocument30
       Dim objNode As MSXML2.IXMLDOMNode
       Dim objChildNode As MSXML2.IXMLDOMNode
       Dim objCData As MSXML2.IXMLDOMCDATASection
       Dim objGrandChildNode As MSXML2.IXMLDOMNode
       Dim objAttribute As MSXML2.IXMLDOMAttribute
       Dim objElement As MSXML2.IXMLDOMElement
       Dim strParamU As String
       Dim strParamP As String
       Dim strParamXML As String
       
       strParamU = "DEMO7207176D8"
       strParamP = "keyn7&WvHT+"
       
       ' Create the main xml node
       Set objNode = objDom.createNode(NODE_PROCESSING_INSTRUCTION, "xml", "")
       objDom.appendChild objNode
       
       
       
       ' Create the Parent Node - "TimbrarCFDPrueba"
       Set objNode = objDom.createNode(NODE_ELEMENT, "TimbrarCFDPrueba", "https://www.fel.mx/WS-TFD")
       
       Set objElement = objNode
       Set objAttribute = Nothing
       
       ' Create Child Node - "usuario"
       Set objGrandChildNode = objDom.createNode(NODE_ELEMENT, "usuario", "https://www.fel.mx/WS-TFD")
            objGrandChildNode.Text = strParamU
            objNode.appendChild objGrandChildNode
    
       ' Create Child Node - "Password"
       Set objGrandChildNode = objDom.createNode(NODE_ELEMENT, "password", "https://www.fel.mx/WS-TFD")
           objGrandChildNode.Text = strParamP
           objNode.appendChild objGrandChildNode
        
       
       ' Create Child Node - "Cadena"
       Set objGrandChildNode = objDom.createNode(NODE_ELEMENT, "cadena", "https://www.fel.mx/WS-TFD")
       Set objCData = objDom.createCDATASection(XMLFactura.xml)
       
           objGrandChildNode.appendChild objCData
           objNode.appendChild objGrandChildNode
       
       Set objGrandChildNode = Nothing
       
       ' Append "TimbrarCFDPrueba" to the XML Dom Document
       objDom.appendChild objNode
       Set objNode = Nothing
    

    Gracias de antemano por la ayuda y espero haber sido coherente con mi pregunta.

     

     

     

     

     

     

     

    Thursday, October 17, 2013 10:10 PM

Answers

  • Hi,

    Welcome to MSDN forum.

    Please post questions in another forum which uses your native language for better response.

    Since VB6 product is not supported in this forum, you may go to these forums for support:

    #Where to post your VB 6 questions
    http://social.msdn.microsoft.com/Forums/en-US/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b/where-to-post-your-vb-6-questions

    Thank you for your understanding.

    Best regards,
    Franklin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Friday, October 18, 2013 5:19 PM
    • Marked as answer by Just Karl Monday, October 28, 2013 3:29 AM
    Friday, October 18, 2013 3:20 AM