Options

Create xml-file with multiple namespaces Nav 2013R2

amw79amw79 Member Posts: 3
Hi
I have an xmlport that creates an xml-file with Service Invoices. The file must have multipla namespaces. How do I do that? Can I create it an then add the namespaces with a function like there is functions to remove namespaces when importing xml-files?

/Anna

Answers

  • Options
    Peter+is1Peter+is1 Member Posts: 174
    Hello,

    If you can just add a row to the XMLport...
    Below the root element you would do something like this.
    (or do multiple with different Name and Data Source)

    Node Name Node Type Source Type Data Source
    xmlns:ns1 Attribute Text <xmlns:ns1>

    Then in code with the trigger(s):
    xmlns:ns1 - Export::OnBeforePassVariable():

    Set the correct namespace:
    "xmlns:ns1" := ('http://www.w3.org/2001/XMLSchema-instance');

    \\
    The truth exists in seven versions.
  • Options
    amw79amw79 Member Posts: 3
    That works fine but not with the default namespace xmlns. Then I got this error when running the xmlport.
  • Options
    Peter+is1Peter+is1 Member Posts: 174
    Hello,

    UseDefaultNamespace & DefaultNamespace are XMLport properties.
    Which you can set design time.

    Hope that helps...
    \\
    The truth exists in seven versions.
  • Options
    santoshkmrsinghsantoshkmrsingh Member Posts: 2
    The issues is not with the attribute name but with the variable name, as Navision does not allow colon in the variable names.

    In the property sheet please change the variable name to exclude the (:) colon,
  • Options
    KishormKishorm Member Posts: 921
    You need to use the Namespaces property. Have a look at the following blog which shows you how...

    https://ksdconsultancy.blog/2015/10/13/multiple-namespace-support-in-xml-ports-microsoft-dynamics-nav-2016/
Sign In or Register to comment.