Header and special type in XML document

Rallnus
Member Posts: 79
I search for a solution to get the following results:
The xml-Dokument should have a header like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
Some nodes should have the extension "type.." or "version.."
<PARTY_ID type="buyer_specific">0662406</PARTY_ID>
or
<ORDERRESPONSE version="1.0">
How can i specialize a node like this?
Thx for your input..
The xml-Dokument should have a header like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
Some nodes should have the extension "type.." or "version.."
<PARTY_ID type="buyer_specific">0662406</PARTY_ID>
or
<ORDERRESPONSE version="1.0">
How can i specialize a node like this?
Thx for your input..
Rallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)
0
Answers
-
The XML declaration is a special type of processing instruction. Use the XMLDOMDocument's createProcessingInstruction and appendChild methods to add this to your document.
Attributes, such as "type" in your example, can most easily be set using the setAttribute method of an XMLDOMElement.Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
jhoek, thank you very much!
But I've got 2 problems left:
1. I get an error when i try to use the function "insert before", because it isn't allowed to insert a processing instruction before the first node.
2. when i read xml-files the import will break, when the file contents special signs like @, &... how can i improt files with these signs?
greetings, rallnusRallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)0 -
Ad 1.
Perhaps you should append the processing instruction before you do anything else. I used this technique several times and the past, and never experienced any problems. Post a snippet of your code to this forum if your problem persists.
Ad 2.
I think you should escape these special characters as follows:
& must be replaced with &
< must be replaced with <
> must be replaced with >
' must be replaced with '
" must be replaced with "
(the trailing semicolon is part of the entity)Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.0 -
Ad 1.
Perhaps you should append the processing instruction before you do anything else. I used this technique several times and the past, and never experienced any problems. Post a snippet of your code to this forum if your problem persists.
Ad 2.
I think you should escape these special characters as follows:
& must be replaced with &
< must be replaced with <
> must be replaced with >
' must be replaced with '
" must be replaced with "
(the trailing semicolon is part of the entity)Kind regards,
Jan Hoek
Product Developer
Mprise Products B.V.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