This message is for C/AL programmers:
The call to member createNode failed. msxml3.dll returned the following message: Reference to undeclared namespace prefix: 'icc'.
CREATE(XMLPurchaseOrder); // Initialiser DocNameSpace := ''; Prefix := 'icc'; strHeader := '<?xml version="1.0" encoding="UTF-8" ?><PurchaseOrderInformation/>'; XMLPurchaseOrder.loadXML:=strHeader; XMLCurrNode := XMLPurchaseOrder.documentElement; // >> POI WITH XMLDOMManagement DO BEGIN AddAttribute(XMLCurrNode,'xmlns','urn:purchaseorderinformation:200511'); AddAttribute(XMLCurrNode,'xmlns:util','http://www.proceedo.net/xslt/lib/Util'); AddAttribute(XMLCurrNode,'xmlns:ifc','urn:components:financialaccount:200511'); AddAttribute(XMLCurrNode,'xmlns:ibc','urn:components:business:200511'); AddAttribute(XMLCurrNode,'xmlns:icc','urn:components:core:200511'); AddElement(XMLCurrNode,'References','',DocNameSpace,XMLNewChild,Prefix); XMLCurrNode := XMLNewChild; // >> POI/Refs AddElement(XMLCurrNode,'Reference',PurchaseOrder."No.",DocNameSpace,XMLNewChild,Prefix); AddAttribute(XMLNewChild,'scheme','urn:ibistic:order:reference:buyer'); XMLCurrNode := XMLCurrNode.parentNode; // >> POI Prefix := ''; AddElement(XMLCurrNode,'IssueDate',DateToText(PurchaseOrder."Order Date"),DocNameSpace,XMLNewChild,Prefix); AddElement(XMLCurrNode,'Type','Standard',DocNameSpace,XMLNewChild,Prefix); IF PurchaseOrder.Status = PurchaseOrder.Status::Open THEN txtStatus := 'Open' ELSE txtStatus := 'Closed'; AddElement(XMLCurrNode,'Status',txtStatus,DocNameSpace,XMLNewChild,Prefix); AddElement(XMLCurrNode,'LastUpdated',DateTimeToText(CURRENTDATETIME), DocNameSpace,XMLNewChild,Prefix); Prefix := 'icc'; AddElement(XMLCurrNode,'Amount','',DocNameSpace,XMLNewChild,Prefix); AddAttribute(XMLNewChild,'currency',PurchaseOrder."Currency Code"); XMLCurrNode := XMLNewChild; // >> POI/Amount AddElement(XMLCurrNode,'AmountInclusiveTax',FORMAT(PurchaseOrder."Amount Including VAT"),DocNameSpace,XMLNewChild,Prefix); AddElement(XMLCurrNode,'AmountExclusiveTax',FORMAT(PurchaseOrder.Amount),DocNameSpace,XMLNewChild,Prefix); AddElement(XMLCurrNode,'TaxAmount',FORMAT(PurchaseOrder."Amount Including VAT"-PurchaseOrder.Amount), DocNameSpace,XMLNewChild,Prefix); XMLCurrNode := XMLCurrNode.parentNode; // >> POI ... END; XMLPurchaseOrder.save(ExportDir);
Comments
I have problem like this.
Can you hep me ?
The trick is to declare the namespaces with a text constants (to make life easier...), and use the text constant instead of the prefix as last parameter in all Element-function calls where a prefix is used.