Question about XMLport with repeated attributes

northernernortherner Member Posts: 67
I am creating an XMLport which must generate XML with fields like this:
<firstName xsi:type="xsd:string"/>
<lastName xsi:type="xsd:string"/>
<company xsi:type="xsd:string"/>

The 'xsi:type' is added to the XMLport as an attribute. Currently I've got it set as 'source type' = text, and 'data source' of xsdstring. In the OnInitXMLport trigger, there's a line of code assigning a value to the field:
xsdstring := 'xsd:string';

The problem is when I try to save the XMLport, I get an error message saying that

Microsoft Dynamics NAV Classic
The variable XSDSTRING is defined more than once.

An example could be: 'File' exists as both a data type and a global variable.

OK

Because the value is used many times, I don't want to declare and assign 'xsdstring1', 'xsdstring2', etc. I also don't have / need the value in a table, so don't really want to create a new table to store the value. What's the best way of doing this?

Many thanks in advance!

Comments

  • ara3nara3n Member Posts: 9,256
    xmlport can't handle namespaces. You'll have to use MSxmldom to generate the xml file.
    You can create the xml file first with xmlport without the namespaces and then add it with msxmldom
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.