You are on page 1of 2

Automatically create a XMLport from a XML schema.

Simply load the schema, give an object number, select the root node,
and click "Generate". Finished! The rest is small business.
Written by Carsten Scholling <cscholling@hotmail.de>
If you find it usefull, use it regulary, find any bugs or simply like to write,
please send me an e-mail.
Author:
Version:
E-Mail:
Copyright:

Carsten Scholling
1.3.0.2
cscholling@hotmail.de
(c)2007-2012 Carsten Scholling

Applies to:

Microsoft Business Solutions Navision,


Microsoft Dynamics NAV
"Microsoft Dynamics NAV" and "Navision" are trademarks of the
Microsoft Corporation.

License:
of

This software is distributed free of charge. Redistribution free


charge including this file is allowed, selling this software is
forbidden without the prior written permission of the author. Use
this software at your own risk. There is no guarantee that it wor

ks
as expected on all configurations nor is there any warranty.
Purpose:
t

Have you ever created a XMLport from scratch? You created the por
line by line based on a schema file. Then tried to import a docum

ent
and nothing happened because one or more of the dozends of tags h
ave
wrong minOccurs and/or maxOccurs values?
Then the debug session. Maybe you have written dummy lines into t
he
triggers to see which part of the XMLport is wrong. After a long
time you discovered your mistake and fixed it.
All that is over. Simply load the schema, give an object number,
select the root node, and click "Generate". Finished!
The rest is small business.
Configuration: A configuration file is provided to set up some general values:
<appSettings>
<add key="VerboseOutput" value="true"/>
<add key="AbbreviationLength" value="4"/
>
<add key="MaxVariableNameLength" value="
30"/>
<add key="MaxNodeNameLength" value="30"/
>
</appSettings>
<NavXmlPortGen>

<Cultures>
<Culture name="de-DE" dateFormat
="dd.MM.yy" timeFormat="HH:mm:ss" />
<Culture name="en-US" dateFormat
="MM\/dd\/yy" timeFormat="\[h:mm:ss tt\]" />
</Cultures>
</NavXmlPortGen>
VerboseOutput: If true, all properties like minOccurs or maxOccur
s
will be set, whether it is the default value or not. If false,
defaults will not be overwritten.
AbbreviationLength: DataSource variable names have a maximum of 3
0
characters. They will be shortened to the length of this value. I
f
the resulting name is a duplicate, a number is appened.
MaxVariableNameLength: This is the maximum length the variable na
me
can be. Do not increase the default value.
MaxNodeNameLength: Maximum Dynamics NAV XMLport node name length.
Cultures/Culture: Date and time format strings in .NET syntax for
the given culture name. You can select which culture setting to
use for output.
Some notes:
- Please make sure you use a XML-schema file (XSD) instead of a XML-file. NAVxml
PortGen
can import files with XML extension, but it has to have a schema structure.
To generate a schema file from the XML, you can use Visual Studio to open the
XML
file and use "Create Schema" from the XML-Menu.
- Some schema files have a huge number of references and the XmlSchemaReader tak
es a
longer time to process before populating the available root nodes in the GUI.
- With very large schemas and huge structures, using XMLports may be not be one
of the
best approaches for data exchange. I've seen XMLports with so many nodes, wher
e
Dynamics NAV took minutes to accept a change in designer. Then you may should
have a look into BizTalk Server :)
- Sometimes, a tree is simply a tree :)
Have fun!

You might also like