Error When Create & Load MSXML DOM Document.

bestianhow
bestianhow Member Posts: 120
Hi Experts,
I have encounter error during passing the Bigtext (XML Data) to a function
PassXMLData(VAR XMLData : BigText)
=============================

IF CREATE(XMLDOMDoc) THEN BEGIN
  IF XMLDOMDoc.load(XMLData) THEN BEGIN
    MESSAGE('Loaded Successfully!');
  END ELSE BEGIN
    MESSAGE('Load failed!');
  END;
END ELSE BEGIN
  MESSAGE('XML DOM Cannot be created!');
END;

Please find attached the error.

Thanks.

Comments

  • ara3n
    ara3n Member Posts: 9,258
    You cannot load bigtext into msxmldom

    XMLDOMDoc.load(XMLData)


    You need to change that

    XMLData.createinstream(iStream);

    XMLDOMDoc.load(iStream);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • bestianhow
    bestianhow Member Posts: 120
    Hi ara3n,
    Thanks for reply.
    XMLData.createinstream(iStream);
    XMLDOMDoc.load(iStream);

    Base on your coding above, XMLData is BigText, so it cannot use createinstream.

    Any idea?

    Thank you.
  • ara3n
    ara3n Member Posts: 9,258
    XMLData.read(Istream);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • navinb
    navinb Member Posts: 51
    Hi ara3n,

    Loading XMLDoc with instream throws an error in RTC :

    "streams cannot be used with client side invoked automation objects"

    Is there any way can use a bigtext variable in RTC to load XML document ?
  • ara3n
    ara3n Member Posts: 9,258
    why are you invoking the automation at client side?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • navinb
    navinb Member Posts: 51
    I have one another COM automation that i have to invoke on client side as it has some visual display .I am sending COM the XML Dom which i can invoke on server .But when i do that it says that client and server side cannot be mixed .So i have to use xml dom automation on client .Please suggest ,if it is possible using either instream or bigtext .Also if it is possible if i can send stream text only without any file drop .

    Thanks !!
  • ara3n
    ara3n Member Posts: 9,258
    You need to upload the blob as file to the client side int a temporary folder. then use

    xmldom. load('LocationofTemoraryFile);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • amphysvena
    amphysvena Member Posts: 113
    Just try
    XMLDOMDoc.loadxml(format(XMLData));

    it works for me, but i don't know if there is any consequences using format for big text.
    Thanks
  • rmv_RU
    rmv_RU Member Posts: 119
    1. Try to use LoadXML method instead of Load.
    2. Try pass XML data as variant.

    Also, you can use 'Microsoft XML, v3.0'.IXMLDOMText' object instead of bigtext datatype (it's trick for older nav versions).
    Here sample code:
    xmlResultNode:=xmlDoc.documentElement.selectSingleNode('./soap:Body/RelationshipsResponse/RelationshipsResult');
    IF NOT ProcessResult(retVal) THEN
      EXIT(retVal);
    xmlDomText:=xmlContentNode.selectSingleNode('./text()');
    CLEAR(lXmlDoc);
    CREATE(lXmlDoc);
    IF NOT lXmlDoc.loadXML(xmlDomText.nodeTypedValue) THEN
      EXIT(Err0001);
    
    Looking for part-time work.
    Nav, T-SQL.