Unable to load xml directly from blob

Sunset
Member Posts: 201
I have a record that has a BLOB containing a xml file. I'm trying to handle the xml without having to write it to a file first, but for some reason I can't load the xml directly from the stream 
What I'm trying to achieve is the below code, but the resulting xml is blank
Have tried various ways of generating and saving the record, as well as loading the xml out again; but so far unsuccesful
I'm slowly running out of things to try, so would love some suggestions [-o< Willing to use some roundabout to reach the goal, but really don't want to involve writing to the disc.

What I'm trying to achieve is the below code, but the resulting xml is blank
CREATE(xmldoc2); Log.CALCFIELDS("Request XML"); Log."Request XML".CREATEINSTREAM(InS); xmldoc2.load(InS); xmldoc2.save('c:\xml\ins.xml'); //Temporary check to see if the xml is validThe code below works, so I know that the xml file is there. Reading the last characters and truncating, as I noticed that for some reason there are filler chars at the end
Log.CALCFIELDS("Request XML"); Log."Request XML".CREATEINSTREAM(InS); LogFilename := 'c:\xml\log.xml'; File.CREATE(LogFilename); File.CREATEOUTSTREAM(OutS); COPYSTREAM(OutS,InS); File.READ(LastChar); WHILE (LastChar[1] = 0) DO BEGIN File.SEEK(File.POS - 2); File.READ(LastChar); END; File.TRUNC; File.CLOSE; xmldoc.load(LogFilename);Realizing that there might be something wrong with the xml going into the blob I've tried checking it there, but it looks ok. The code itself recieves a node, combines it with the processing instruction and saves the result using:
Log."Request XML".CREATEOUTSTREAM(OutS); OutS.WRITE(xmldoc.xml);To make sure that ingoing xml was ok I tried saving the result (ends as a proper xml), load that file into a xmldoc and saving that into the blob. The result of the load routine is the same as saving it directly ](*,)
Have tried various ways of generating and saving the record, as well as loading the xml out again; but so far unsuccesful

I'm slowly running out of things to try, so would love some suggestions [-o< Willing to use some roundabout to reach the goal, but really don't want to involve writing to the disc.
Don't just take my word for it, test it yourself
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions