Dynamics NAV XMLport Generator v1.0.0.1
Have you ever created a XMLport from scratch? You created the port line by line based on a schema file. Then tried to import a document and nothing happened because one or more of the dozends of tags have wrong minOccurs and/or maxOccurs values?
Then the debug session. Maybe you have written dummy lines into the 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 and click "Generate". Finished!
Of course you have to change the SourceType and DataSource, but that's a small business.
Requires .NET Framework 2.0
http://www.mibuso.com/dlinfo.asp?FileID=910
Discuss this download here.
Comments
I tested this solution and if I have simple schema, no problem. But I use including (imported) schema and then generator not work correct.
Have a nice day
M@rtin
Example imported XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="uri:iw.sha.synchro.location"
xmlns="uri:iw.sha.synchro.location"
xmlns:types="uri:iw.types"
elementFormDefault="qualified"
version="1.1">
<xs:import namespace="uri:iw.types" schemaLocation="types.xsd"/>
<xs:element name="synchronization">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="Code" type="types:naviCode10" />
......
</xs:sequence>
<xs:attributeGroup ref="types:headerSynchroAtt"/>
</xs:complexType>
</xs:element>
</xs:schema>
Types schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="uri:iw.types"
xmlns="uri:iw.types"
xmlns:types="uri:iw.types"
elementFormDefault="qualified" version="3.1">
<xs:attributeGroup name="headerSynchroAtt">
<xs:attribute name="messageNo" type="number" use="required"/>
<xs:attribute name="primaryKeyString" type="text" use="required"/>
....
</xs:attributeGroup>
<xs:simpleType name="naviCode10">
<xs:restriction base="text10">
<xs:pattern value="[^a-z]*"/>
</xs:restriction>
</xs:simpleType>
.....
</xs:schema>
sorry for answering so late.
I will check this when i'm back at home in a few days.
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
i've checked your example a bit deeper and also checked it with Visual Studio wich gives some unreferenced types. After defining the missing references (number, text and text10) i see no problem. I've attached the two schemas and the output.
What was the exact error you received?
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
I have used this tool and I have a problem with an specific XML file.
The XML file is:
The Xsd related to the XML file generated with Visual Studio 2005 is:
The XMLPort textfile generated with your program is:
When I try to execute this XMLport the next error appears approximately (the original message is in spanish):
<<The value Min Occurs specifies the apparition of element <TPVS> once. The <id> element was received.>>
Please, am I doing anything wrong?
Thank you and my best regards.
i checked with your supplied schema and xml and had no problem to import the supplied XML.
But the error sounds like the XML you are trying to import has another format as the one you supplied. There are some candidates in your XML which may occur multiple times in a "real world scenario". These are <Shop>, <TPV>, <batch> and <transaction>. Try changing the schema of these nodes to maxOccurs=unbounded or try to generate a schema from the "defective" XML. There are also some potential optional values in your XML which should be marked with minOccurs=0 in your schema.
Regards,
Carsten
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
I opened the xml file in Visual studio. Generated the xsd, then added this to the tool and it generated the xmlport.
One issue is that Datasources cannot be longer than 30 characters.
I found the source and made it smaller.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
This seems to be the perfect tool for me but unfortunately I'm getting error message "Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'".
I'm new to XML, can you tell me what could be the problem?
Hi JAKA,
the problem is the implementation which parses the supplied schema and fails in case of <choice>. I'm working on this issue and have hopefully fixed it in a test version. A temporary workaround is to eleminate <choice> and specify all choices as minOccurs=0. Expect an update in the next two weeks.
Greets,
Carsten
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
Simple automatic creation of NAV XMLport objects from a XML Schema (.XSD).
Have you ever created a XMLport from scratch? You created the port line by line based on a schema file. Then tried to import a document and nothing happened because one or more of the dozends of tags have wrong minOccurs and/or maxOccurs values?
Then the debug session. Maybe you have written dummy lines into the 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 and click "Generate". Finished!
Changes in 1.1.0.0:
- Added support for choice types
- Fixed a problem with sequences
- Fixed small bugs and typos
- Checked with NAV 2009
http://www.mibuso.com/dlinfo.asp?FileID=910
Discuss this download here.
but the XSD->Dataport using your Generator is not creating the entire dataport only a few lines.I guess your tool works for only simple XSD files
GD
hmm, it should create a full featured XMLport. Can you send me the resulting XSD with all referenced files per PM? I will have a look at your issue and come back to you.
Thanks and kind regards,
Carsten
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
GD
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
http://www.mibuso.com/awards2009vote.asp
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thx
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
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.
Features:
- Automatic object generation
- Works with complex schemas
- Load included schemas
- Root node selection
http://www.mibuso.com/dlinfo.asp?FileID=910
Discuss this download here.
When I try use your XML Generator it won't let me select the root element. And when I try generate i get this error:
Unhandled exception has occured in your application. If you click continue the application will ignore this error and attempt to continue. If you quit, the application will close immediaitely.
Object Reference not set to an instance of an object.
Any ideas?
:-k
can you send me the XML schema file via PM? This is not a general error...
Greetings,
Carsten
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
sorry but can anyone explain me how to use that tool - i've downloaded it and extracted it and see no .fob, no exe :shock:
I need a short description how to get it working because i don't know how to start it :whistle: +
Thx,
Markus
Table objects in the root element field not just comment and PO. Thanks in advance! This looks like a good tool for creating
an initial XML port.
Regards., Mouseware
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
You wrote in readme.txt
AbbreviationLength: DataSource variable names have a maximum of 30
characters. They will be shortened to the length of this value. If
the resulting name is a duplicate, a number is appened.
Can you use UPPERCASE (LOWCASE) compare when searching duplicate name?
Thank`s
I'm also getting the error (working with v1.2)
"Unable to cast object of type 'System.Xml.Schema.XmlSchemaChoice' to type 'System.Xml.Schema.XmlSchemaElement'".
any idea how i can fix this?
Thank you very much.
I want to import some XML documents via a XMLPort according to a XML Schema. But I would like a way to auto generate my XMLPort, because it is a gigantic task to create it manually.
The schema is here: http://docs.oasis-open.org/ubl/os-UBL-2 ... ce-2.0.xsd
The schema is located in this folder: http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/
I've tried this engine, but it seems to crash just before ending the generation process. There are other problems also, - I needed to shorten two fieldnames, but this does not cause the crash.
Any solution to this? Are there any other engines available? Or any other way to set up the environment in NAV to accept XML files according to the XML Schema??
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I have used this engine before to make a working OIOXML XMLPORT, that was very helpful.
Today I tried to make the OIOUBL XMLPORT, but I get a run time error when I try to click Generate, I also get two error complaints about field length, which i fixed manually, but regardless, it will crash a little bit later on with no file generated.
I missed this thread, sorry...
Povl pointed me back to this thread and I have compiled a new version for testing. The schema is very complex and it uses some kind of circular reference, I have never seen before. This was the problem and can possibly omitted by creating a XML file then then creating a schema from this XML as ar3na mentioned.
The generated XMLport for this schema is very large. The text object has more than 216.000 lines and I did not test the result today.
I will upload a new version if it works for Povl.
Cheers
Carsten
P.S.: It may take some (more) seconds to create the XMLport for this schema, depending on your CPU power...
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
Thanks for the update, the generator works and creates the baddest XMLPORT I have ever seen for this OIOUBL XSD (v. 1.0) with 20+ mb. The similiar XSD for the OIOXML (v.0.7) was only 500kb.
I tried to see if there was duplicate fields, but it seems all are unique indeed. The XMLPORT is so far not working,but I am trying some things.
I will probably as suggested in thread try and create the XSD from some example files.
As I understand, if the example file does not cover all possible tags, I could get in trouble later.
Kind regards,
Povl