Xml diffrent structure in One Xml File

JedrzejT
Member Posts: 267
Hello,
I have problem with import xml via XmlPort (Nav 5, SQL)
As i know XmlPort must have strongly defined structure.
I have 2 elements with diffrent data inside (based on data inside it)
So I have Element 'Meta' with structure like that
And the same element with other strucutre
Problem is that one structure have TxDt and next NetworkId, and other structure is NetworkId,TxDt. Both strucutres exist in the same Xml Stream (can't be imported via 2 diffrent xmlports)
Maybe someone have an idea how to handle that without building new import without xmlport?
I have problem with import xml via XmlPort (Nav 5, SQL)
As i know XmlPort must have strongly defined structure.
I have 2 elements with diffrent data inside (based on data inside it)
So I have Element 'Meta' with structure like that
Meta Element DeviceType Element Encoding Element RxDT Element NetworkId Element TxDT Element MsgType Element
And the same element with other strucutre
Meta Element DeviceType Element Encoding Element TxDT Element NetworkId Element MsgType Element
Problem is that one structure have TxDt and next NetworkId, and other structure is NetworkId,TxDt. Both strucutres exist in the same Xml Stream (can't be imported via 2 diffrent xmlports)
Maybe someone have an idea how to handle that without building new import without xmlport?
0
Comments
-
So do you say your xml file looks something like this?:
<?xml version="1.0" encoding="utf-8"?> <root> <Meta> <DeviceType/> <Encoding/> <RxDT/> <NetworkId/> <TxDT/> <MsgType/> </Meta> <Meta> <DeviceType/> <Encoding/> <TxDT/> <NetworkId/> <MsgType/> </Meta> </root>
For me it'd look wrongly formed xml file. Although the tags might be able to swap around with XMLDom automation before importing it. Then you'd be able to use same Meta element with childs on the xml file.
Can you post the DTD of that xml file you are trying to import?K.S.0 -
Hello,
Thank You for answering on so old post.
I can't attach DTD , becuse.. simple there are no DTD section inthis file.
There is just first element on the begining
For detail it look like that..<Subscription user="xxx" datetime="xxx"> <Summary> <SomeFileds>xxx</SomeFileds> <SomeFileds>xxx</SomeFileds> <SomeFileds>xxx</SomeFileds> </Summary> <Messages> <Msg PacketId="xxx" PosId="xxx"> <SomeFileds>xxx</SomeFileds> <SomeFileds>xxx</SomeFileds> <SomeFileds>xxx</SomeFileds> <Data> <Msg> </Meta> <SomeFileds>xxx</SomeFileds> [b]This meta element can have diffrent structure in one xml[/b] </Meta> <Data> <SomeFileds>xxx</SomeFileds> <SomeElements> <SomeFileds>xxx</SomeFileds> </SomeElements> </Data> </Msg> </Data> </Msg> </Messages>
For now, because i don't have to use those "problematic fields" i just read file, replace wrong elements with other names and import like that. I just ask to know is there some other (better) way to do it (with XmlPort object)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