Load InStream to Xml Automation

PureHeartPureHeart Member Posts: 190
Hi All,

I'm really struggling here with something that should be simple....

What I am trying to do is to load a stream to the XML DOMDocument automation without saving it to a file and then loading it.......but it doesn't work the load instruction fails without any error but simply not writing anything to the automation...
here's the code
CREATE(XMLDocOut);

TempBlob.Blob.CREATEOUTSTREAM(OutStream);

OutStream.WRITE('<a>test</a>');

IF TempBlob.Blob.HASVALUE THEN BEGIN
  TempBlob.Blob.CREATEINSTREAM(StreamInObj);

  //This always returns zero, so the loading fails..but WHY????
  MESSAGE(FORMAT(XMLDocOut.load(StreamInObj)));
END;

//This File is empty
XMLDocOut.save('c:\stream2.xml')

Please HELP!!!

Thanks ALL
Why don't you try my compare tool?
http://www.mibuso.com/dlinfo.asp?FileID=1123

Comments

  • canadian_baconcanadian_bacon Member Posts: 91
    use TempBlob.CALCFIELDS(Blob) before TempBlob.Blob.HASVALUE
  • PureHeartPureHeart Member Posts: 190
    yes i'm using calcfields but it doesn't change....:(
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • PureHeartPureHeart Member Posts: 190
    Please HELP!
    Am I the only one that had this idea?? ](*,)
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • pduckpduck Member Posts: 147
    Use WRITETEXT instead of WRITE.

    Maybe you should also not name Fields and Variables with reserved Words like Blob or OutStream.
  • PureHeartPureHeart Member Posts: 190
    Use WRITETEXT instead of WRITE.

    Maybe you should also not name Fields and Variables with reserved Words like Blob or OutStream.

    Thank you so much Alexander I thought I tried the WRITETEXT but.....It is now working! :lol::D:D
    This is the code that will work:
    CREATE(XMLDocOut);
    
    TempBlob.Blob.CREATEOUTSTREAM(OutStream);
    OutStream.WRITETEXT('<a>test');
    OutStream.WRITETEXT('<b>test');
    OutStream.WRITETEXT('<c>test</c></b></a>');
    
    TempBlob.Blob.CREATEINSTREAM(InStream);
    
    XMLDocOut.load(InStream);
    
    XMLDocOut.save('c:\stream2.xml')
    

    Thanks Again and I hope this will help someone else!
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • prateekarya2011prateekarya2011 Member Posts: 40
    Hiii PureHeart, nice post.... i need your help actually i have to do similar kind of thing, i would be thankful to you if you could tell me the type of the variables that you have used in this code. :lol:

    Thanks in advance =D>
  • PureHeartPureHeart Member Posts: 190
    Yes sure the XMLDocOut is an automation of Microsoft XML, v3.0'.DOMDocument and tempblob is the table tempblob and outstream is outstream... :)
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • prateekarya2011prateekarya2011 Member Posts: 40
    Thanks for the reply Pure Heart..
    :D I need one more favor from you have you ever seen this kind of error -


    "Streams cannot be used with client-side invoked automation objects."

    Getting this error when ran the code depicted in your post...
    Am working on NAV 2013 r2.

    Thanks In advance =D>
Sign In or Register to comment.