Line Break in XML Files?

ta5
Member Posts: 1,164
Hi
I've created an XML Document in Navision using the DOM Object and some functions of code unit 6224. That's quite ok, the file looks ok in a viewer programm (internet explorer for example).
If viewed with a text editor, there are no line breaks in the file. This is a problem if the file later causes a parsing error (XMLParseError.line is useless and XMLParseError.src l would exceed 1024 characters).
As I understand, line breaks are not part of the xml specification, but become very handy for debugging reasons.
Any ideas?
Many thanks in advance
Thomas
I've created an XML Document in Navision using the DOM Object and some functions of code unit 6224. That's quite ok, the file looks ok in a viewer programm (internet explorer for example).
If viewed with a text editor, there are no line breaks in the file. This is a problem if the file later causes a parsing error (XMLParseError.line is useless and XMLParseError.src l would exceed 1024 characters).
As I understand, line breaks are not part of the xml specification, but become very handy for debugging reasons.
Any ideas?
Many thanks in advance
Thomas
0
Comments
-
no ... but we find that some other parsers have problems when the xml contains a linebreak.
we use this function to get most of the information:INF_DOM_PARSEERROR: DOM-Error: "%1" in "%2"\\Reason: "%3"\\Line: %4\Column: %5\File position: %6\\Comment: %7 ShowDOMParseError(vau_ParseError : Automation "'Microsoft XML, v4.0'.IXMLDOMParseError";vtx_AddMsgText : Text[250];vbn_ShowAsError : Boolean) IF vbn_ShowAsError THEN ERROR(INF_DOM_PARSEERROR, FORMAT(vau_ParseError.errorCode), vau_ParseError.url, vau_ParseError.reason, FORMAT(vau_ParseError.line), FORMAT(vau_ParseError.linepos), FORMAT(vau_ParseError.filepos), vtx_AddMsgText) ELSE MESSAGE(INF_DOM_PARSEERROR, FORMAT(vau_ParseError.errorCode), vau_ParseError.url, vau_ParseError.reason, FORMAT(vau_ParseError.line), FORMAT(vau_ParseError.linepos), FORMAT(vau_ParseError.filepos), vtx_AddMsgText);
and don't try to put srcText in the message when working with very big files0 -
Thank you for your message. Works very well.
There is another problem with validation:
To validate a xmlDoc against its schema, I often use a function similar to function validatexmldocument in codeunit 99008518. This works sometimes ok, but sometimes only with xml4-objects and sometimes not at all (when it does not work an error occurs in the add-method of the schemacache -- so I have no chance to handle the error).
As far as I know, there are 3 concepts to test against a schema: noNameSpaceSchemaLocation, schemaLocation and schema cache. I guess schema cache is convenient, because it does not depend on a given filename in the xmlDoc.
Do you have a "bullet proof" method to validate against its schema?
Many thanks in advance
Thomas0 -
sorry we haven't. because of all the different specifications for schemas and their validation (every parser version uses another way) we only validate against dtd if we need a validation now.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