XMLport import XML doesnt work when xmlns attribute within XML root in BC

MichelUpdMichelUpd Member Posts: 1
edited 2023-01-25 in NAV Three Tier
When using Xmlport.Run, i am getting "The Attribute is unexpected."

XML sample:
<?xml version="1.0" encoding="UTF-8"?>
<Order xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
 <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
 <cbc:CustomizationID>Test</cbc:CustomizationID>
 </Order>

BC XMLPort sample :
xmlport 50001 "xmlporttest"
{
    Format = Xml;
    Caption = 'xmlport test';
    Direction = Import;
    Encoding = UTF8;
    Namespaces = "" = 'urn:oasis:names:specification:ubl:schema:xsd:Order-2', xs = 'http://www.w3.org/2001/XMLSchema', cac = 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2', cbc = 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2';
    UseRequestPage = false;
    DefaultNamespace = 'urn:oasis:names:specification:ubl:schema:xsd:Order-2';
    UseDefaultNamespace = true;
    

    schema
    {
        textelement(orderheader)
        {

            MaxOccurs = Once;
            XmlName = 'Order';

            textelement(UBLVersionID)
            {
                NamespacePrefix = 'cbc';
            }

            // SourceTableView = sorting(Number) where(Number = filter(1 ..));
            textelement(CustomizationID)
            {
                NamespacePrefix = 'cbc';
            }
        }
    }
}

i tried removing DefaultNamespace, and removing "" from Namespaces, changing UseDefaultNamespace true/false
but whatever i do, i still get the same error : "The Attribute is unexpected."

the error wont be displayed if xmlns="urn:oasis:names:specification:ubl:schema:xsd:Order-2" is removed from the XML file
Sign In or Register to comment.