Load XML files from BLOB field with DTD via stream

einsTeIn.NET
Member Posts: 1,050
Hello everybody,
I want to load a xml file form a BLOB field via stream. The problem is that the xml file contains a document type definition. Everytime I want load the file with XML DOM Document I get an error message that the specified DTD file couldn't be found.
Does anyone have a better suggestion? Or maybe a way to tell the load function where the DTD file could be found?
I want to load a xml file form a BLOB field via stream. The problem is that the xml file contains a document type definition. Everytime I want load the file with XML DOM Document I get an error message that the specified DTD file couldn't be found.
CALCFIELDS("Data (received)"); IF "Data (received)".HASVALUE THEN BEGIN IF NOT ISCLEAR(XMLDocument) THEN CLEAR(XMLDocument); CREATE(XMLDocument); "Data (received)".CREATEINSTREAM(InS); XMLDocument.load(InS); END;I got the DTD file, so it would be possible to save it into a specific folder, save the xml file into the same folder and load it from there. But I don't want to generate so much HD traffic and the user will probably work on a terminal server. User rights, file management, device capacity,... that wouldn't be a good solution.
Does anyone have a better suggestion? Or maybe a way to tell the load function where the DTD file could be found?
"Money is likewise the greatest chance and the greatest scourge of mankind."
0
Answers
-
If you are using MSXML 6 this might be usefull http://blogs.msdn.com/xmlteam/archive/2007/03/12/upgrading-to-msxml-6-0.aspx0
-
Very good link. I was using v4, but anyway this helped me to understand a little bit more. As mentioned here (below Remarks) I have to set
XMLDocument.resolveExternals(FALSE);
or in v6 it is FALSE by default.
But now I have another problem. I get the following error message:A document must contain exactly one root element.
Line Number = 1 Column Number = 0<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE myRootElement SYSTEM "myDTD.dtd"> <!-- @version: --> <myRootElement arg01="4711" arg2="0815"> </myRootElement>
"Money is likewise the greatest chance and the greatest scourge of mankind."0 -
Try this.
xmlDocument.async := true; xmlDocument.validateOnParse := false;
Hope this helps
Thomas0 -
Oh, forget it. It was my fault.
XMLDocument.validateOnParse(FALSE);
is the only thing you have to do.
In DOMDocument v6 you have to set alsoXMLDocument.setProperty('ProhibitDTD',FALSE);
In DOMDocument below v6 you have to set alsoXMLDocument.resolveExternals(FALSE);
So, XMLDocument.load is working then. The error message is generated by a subsequent process."Money is likewise the greatest chance and the greatest scourge of mankind."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