xml dom

guptashikha9guptashikha9 Member Posts: 5
edited 2005-04-28 in Navision Attain
hi
i am unable to create an instream object with the blob.
I am using the XmlDom Document automation.
it is giving me the error:
'This automation variable has not been instantiated .You can do it by either creating it or assigning it.'


shikha

Comments

  • pdjpdj Member Posts: 643
    I'm using this code:
    IF NOT CREATE(XMLDoc) THEN
      ERROR('No automation');
    MyRec.CALCFIELDS("XML File");
    MyRec."XML File".CREATEINSTREAM(InStream);
    IF NOT XMLDoc.load(InStream) THEN BEGIN
      CLEAR(XMLDoc);
      ERROR('No valid XML');
    END;
    
    How is your code or did the above help?
    Regards
    Peter
  • guptashikha9guptashikha9 Member Posts: 5
    thanks for your reply.
    The xmldom is being created however,
    as i write the following code,

    xmlDom.load();


    the same error appears.

    Actually i want to save some files in navision database and am looking for a solution.
  • pduckpduck Member Posts: 147
    how do you want to save the files in navision ? from the file system ? then try Field.IMPORT(<filename>) of the BLOB-Field and insert the record.

    If you want to parse the content of a BLOB with a DOMDocument try this:
    IF BLOBField.HASVALUE THEN BEGIN
    BLOBField.CreateINSTREAM(instream);
    IF DOMDocument.load(instream) THEN BEGIN
    <...>
    END;
    END;


    this works inside the table where the blob-field is placed, but maybe you need a calcfields on the blobfield befor you create the instream ?
  • DenSterDenSter Member Posts: 8,307
    The XMLDOM is not created by the Load method. You will have to explicitly create the object before you can load it. So you will need to do this:
    IF ISCLEAR(MSDOM) THEN
      CREATE(MSDOM);
    MSDOM.Load(YourXmlHere);
    

    hth
Sign In or Register to comment.