Hi all,
I'm using Navision 3.70. And are generating an xml-file like this:
START:
variable
Var Name DataType Subtype Length
Ja CurrNode Automation 'Microsoft XML, v4.0'.IXMLDOMNode
Name DataType Subtype Length
xmlInvoice Automation 'Microsoft XML, v4.0'.DOMDocument30
objPI Automation 'Microsoft XML, v4.0'.IXMLDOMProcessingInstruction
CREATE(xmlInvoice);
xmlInvoice.async := FALSE;
xmlInvoice.loadXML('
<pidx:Invoice></pidx:Invoice>');
objPI := xmlInvoice.createProcessingInstruction('xml','version="1.0" encoding="ISO-8859-1"');
CurrNode := xmlInvoice.documentElement;
xmlInvoice.insertBefore(objPI,CurrNode);
xmlInvoice.documentElement.setAttribute('xmlns','
http://www.api.org/pidXML/v1.0');
xmlInvoice.documentElement.setAttribute('xmlns:xsi','
http://www.w3.org/2001/XMLSchema-instance');
xmlInvoice.documentElement.setAttribute('xmlns:pidx','"
http://www.api.org/pidXML/v1.0');
xmlInvoice.documentElement.setAttribute('xsi:schemaLocation',
'
http://www.api.org/pidXML/v1.0 C:\PIDX\Invoice-2002-02-14-V1-0.xsd');
xmlInvoice.documentElement.setAttribute('pidx:transactionPurposeIndicator','Original');
xmlInvoice.documentElement.setAttribute('pidx:version','1.0');
CurrNode := xmlInvoice.documentElement;
END
Of course there's more code
,but my problem is the loadxml('<pidx:Invoice></pidx:Invoice>); it seems like it will not accept the : character. Everthing works fine if I use any other character, or just <pidx Invoice></Pidx Invoice>, without the : .
Does anyone have a clue how to solve this?
Regards
Bente
Answers
xmlInvoice.loadXML('<?xml version="1.0" encoding="ISO-8859-1"?>' +
'<pidx:Invoice></pidx:Invoice>');
and remove
objPI := xmlInvoice.createProcessingInstruction('xml','version="1.0" encoding="ISO-8859-1"');
CurrNode := xmlInvoice.documentElement;
xmlInvoice.insertBefore(objPI,CurrNode);
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
"This Automation variable has not been instantiated. You can instantiate it by either creating or assigning it"
Bent
Regards,
Bente
Thanks.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
CREATE(xmlInvoice);
xmlInvoice.async := FALSE;
xmlInvoice.loadXML('<?xml version="1.0" encoding="ISO-8859-1"?>' +
'<pidx:Invoice></pidx:Invoice>');
xmlInvoice.documentElement.setAttribute('xmlns','http://www.api.org/pidXML/v1.0');
xmlInvoice.documentElement.setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
xmlInvoice.documentElement.setAttribute('xmlns:pidx','http://www.api.org/pidXML/v1.0');
xmlInvoice.documentElement.setAttribute('xsi:schemaLocation',
'http://www.api.org/pidXML/v1.0 C:\PIDX\Invoice-2002-02-14-V1-0.xsd');
xmlInvoice.documentElement.setAttribute('pidx:transactionPurposeIndicator','Original');
xmlInvoice.documentElement.setAttribute('pidx:version','1.0');
CurrNode := xmlInvoice.documentElement;
thanks
Hope this helps.
Thomas
Thank you so much!!
Best regards,
Bente
Glad to help!