xml import

Belias
Member Posts: 2,998
NAV310, fdb
Hi everyone, this is my first experience with xml, so, promise you'll be kind
This is a "chop" of the XML i want to import
I am currently using this code to read the split tag (this is a prototype, a little hardcoded):
FNTGetList(pINTDeepNess : Integer;pTXTNodeName : ARRAY [20] OF Text[250])
My problem is that this code reads all the 'split:quantity' of the transaction, while i want to read:
-split:quantity of the first <trn:split>
-do something
-split:quantity of the second <trn:split>
Hope to be clear....it's a bit hard to explain xml...
Indentation of xml screwed up,i'm sorry...
For your entartainment: a customer called me just now, saying
cust: "i'm trying to insert an invoice and it keeps giving me: 'you have to compile buy-from field in sales header..."
me: "did you compile buy-from field in sales header?"
cust: "no"
](*,) ](*,) ](*,) ](*,)
Hi everyone, this is my first experience with xml, so, promise you'll be kind

This is a "chop" of the XML i want to import
- <gnc:transaction version="2.0.0">
<trn:id type="guid">4cc8f2d05a988f5f8a9d4d2c304ebadc</trn:id>
- <trn:currency>
<cmdty:space>ISO4217</cmdty:space>
<cmdty:id>INR</cmdty:id>
</trn:currency>
- <trn:date-posted>
<ts:date>2009-05-20 00:00:00 +0200</ts:date>
</trn:date-posted>
- <trn:date-entered>
<ts:date>2009-05-19 15:21:30 +0200</ts:date>
</trn:date-entered>
<trn:description>project manager salary</trn:description>
- <trn:splits>
- <trn:split>
<split:id type="guid">9630c8ffb8745d6572b0954c5237b724</split:id>
<split:reconciled-state>y</split:reconciled-state>
- <split:reconcile-date>
<ts:date>2009-05-20 23:59:59 +0200</ts:date>
</split:reconcile-date>
<split:value>2000000/100</split:value>
<split:quantity>29837/100</split:quantity>
<split:account type="guid">4cb93d4fbb0656d2a4225dbaaa161e94</split:account>
</trn:split>
- <trn:split>
<split:id type="guid">7e090b3e8f5d137e96ea26970b345a88</split:id>
<split:reconciled-state>y</split:reconciled-state>
- <split:reconcile-date>
<ts:date>2009-05-20 23:59:59 +0200</ts:date>
</split:reconcile-date>
<split:value>-2000000/100</split:value>
<split:quantity>-2000000/100</split:quantity>
<split:account type="guid">c7e4296146f70fc2d9ccb02b17f93bf2</split:account>
</trn:split>
</trn:splits>
</gnc:transaction>
I am currently using this code to read the split tag (this is a prototype, a little hardcoded):
TXTNodeName[1] := 'trn:split'; TXTTrnID := 'split:quantity'; FNTGetList(1,TXTNodeName); TXTNodeText := ''; INTDeepNess := 1; IF XMLNode[1].hasChildNodes THEN BEGIN REPEAT //some code XMLNode[INTDeepNess] := XMLNodeList[INTDeepNess].nextNode; UNTIL ISCLEAR(XMLNode[INTDeepNess]); END;
FNTGetList(pINTDeepNess : Integer;pTXTNodeName : ARRAY [20] OF Text[250])
XMLNodeList[pINTDeepNess] := XMLDoc.getElementsByTagName(pTXTNodeName[pINTDeepNess]); XMLNode[pINTDeepNess] := XMLNodeList[pINTDeepNess].item(0);
My problem is that this code reads all the 'split:quantity' of the transaction, while i want to read:
-split:quantity of the first <trn:split>
-do something
-split:quantity of the second <trn:split>
Hope to be clear....it's a bit hard to explain xml...
Indentation of xml screwed up,i'm sorry...
For your entartainment: a customer called me just now, saying
cust: "i'm trying to insert an invoice and it keeps giving me: 'you have to compile buy-from field in sales header..."
me: "did you compile buy-from field in sales header?"
cust: "no"
](*,) ](*,) ](*,) ](*,)
0
Comments
-
Xml ports is something we don't use either only thing I can suggest is this sample
viewtopic.php?f=7&t=22660 -
Savatage wrote:Xml ports is something we don't use either only thing I can suggest is this sample
viewtopic.php?f=7&t=2266
Thanks to the one who posted it...but my question is not really clear, maybe...i'll try with a more readable example..
Here's xml
<aaa>
---<bbb>I</bbb>
---<ccc>hate</ccc>
</aaa>
<aaa>
---<bbb>XML</bbb>
---<ccc>!</ccc>
</aaa>
if i load the nodelist of bbb, i'll get "I" and "XML" nodes.
but what if i want to read the xml like this:
<aaa> parent: read bbb and ccc, do something, but i don't want to read the second bbb because it is son of the second aaa!!!how can i do it?and more important..CAN i do it?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