XML Output Options

jversusjjversusj Member Posts: 489
Hello,
I am inexperienced with XML import/export and NAV. I have created a basic import and basic export using XMLPorts in the past, but nothing 'fancy.'

We are in the process of absorbing another division into NAV (previously running Oracle). They have a number of customer facing websites that we need to unplug from Oracle and connect to NAV. This means I have to mimic the XML files Oracle was previously outputting to provide content for these websites.

I don't know which approach to take, XMLPort (which seems limited but more WYSIWYG) or XMLDom (which I have never used).

I ultimately need to create XML structure as follows:
<Product_Info>
 <Company>
  <Company_ID>
  <Category>
   <Category_ID>
   <Sub_Category>
    <Sub_Category_ID>
     <Product_Family>
       <Family_ID>
        <Product>
         <Product_SKU>
        </Product>
       </Family_ID>
     </Product_Family>
   </Sub_Category>
  </Category>
 </Company>
</Product_Info>
I will have recorda that will look like something like this:
Item|Company ID|Category ID|Sub-Category ID|Family
ABC|J011|240|020|KD2020
DEF|J011|240|020|KD2020
GHI|J011|240|030|LM0010
JKL|J011|240|030|LM0010
MNO|J011|300|150|JL4849

I'm not sure how I would use an XMLPort to output all the J011 records, indenting for each change in Category ID, Sub-Category, and Family. This makes me think I have to manually code out all of the elements. Am I right in this assumption, or can it be done with XMLPorts? I am using 5.0 executables on a 3.7b codebase. Any tips?
kind of fell into this...

Comments

  • jlandeenjlandeen Member Posts: 524
    I certainly think from the description of what you are trying to do that XML Ports are definately the best way to structure the data that the external system is looking for.

    In general I like to describe XML Ports as really a special case of dataports. They work in a similar fashion allow you to encode data much easier (as you don't have to worry about field and record seperators) and also applying cardinality rules.

    It might help for you to use some temporary in memory record sets to group and sort the elements that you're exporting in a similar hierarchy to your example.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • jversusjjversusj Member Posts: 489
    thanks Jeff - I couldn't come up with how to structure the temporary record sets to make the XMLPort work. Using some example XML DOM code i found, I have been able to get something rolling. If you have any specific tips for how I could get the grouping I referred to in my original post, I'm all ears! Otherwise, I guess I'll continue to follow along the XML DOM path.

    EDIT:
    I'm actually nearly done with the XML DOM approach. I have successfully created data in the required structure! :)
    kind of fell into this...
  • jlandeenjlandeen Member Posts: 524
    I was just poking around on the MSDN sight and Microsoft is really starting to do a much better job of providing online support and developer documentation (much like what they do with their VS.net products) for NAV.

    There's some more details on XML Ports
    http://msdn.microsoft.com/en-us/library/dd338846.aspx although it doesn't appear to get into too much detail about any really advanced XML Port stuff :(
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.