Reading XML items results in error

Leon67
Member Posts: 5
Hi All,
I am currently trying to read a xml document. So far all works fine besides the tags that are optional.
If a optional tag is not present in the xml document a error occurs. I want to test if a optional tag is present or not before reading it but I can't seem to find a way to do this, can anyone point me in the right direction?
Regards,
Leon
I am currently trying to read a xml document. So far all works fine besides the tags that are optional.
If a optional tag is not present in the xml document a error occurs. I want to test if a optional tag is present or not before reading it but I can't seem to find a way to do this, can anyone point me in the right direction?
Regards,
Leon
0
Comments
-
I suppose the answer depends on which technique you are using. Are you using the XMLDOM? Show us some code, and someone may be able to help you!Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
If you are using xmlPorts check the following:
If your tag is an attribute, check the property Occurrence and set it to Optional
if your tag is an element , check the properties MinOccurs and MaxOccurs:
set MinOccurs to Zero and MaxOccurs to Unbounded
If you are using XMLDOM check the Commerce Portal Codeunit 6226 "XML Document Decode"
An excerpt of this Codeunit where the existence of the tag GUID is done:IF NOT FindNode(XMLNode,'GUID',XMLNodeFound) THEN EXIT ELSE IF STRLEN(XMLNodeFound.text) > 0 THEN GUID := XMLNodeFound.text;
Hope this helps!Now, let's see what we can see.
...
Everybody on-line.
...
Looking good!0 -
I am using XMLDom objects, not xml ports. I'll look into the codeunit this may be the answer I was looking for.
Regards,
Leon0
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