Hello,
I have to create a XML file for each invoice a customer issues, but the 1st line/tag is giving me a hard time.
I read some posts where the suggestion is to use psSelectionNamespaces, but under VDF14.1, the compiler doesn't like it, probably working with newer VDF versions.
This is what I need:
Code:
<?xml version="1.0" encoding="UTF-8"?>
-<InvoicesDoc xmlns:ecls="https://www.aade.gr/myDATA/expensesClassificaton/v1.0" xmlns:icls="https://www.aade.gr/myDATA/incomeClassificaton/v1.0" xsi:schemaLocation="http://www.aade.gr/myDATA/invoice/v1.0/InvoicesDoc-v0.6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.aade.gr/myDATA/invoice/v1.0">
-<invoice>
-<issuer>
<vatNumber>998380246</vatNumber>
<country>GR</country>
<branch>1</branch>
</issuer>
-<counterpart>
<vatNumber>027052555</vatNumber>
<country>GR</country>
<branch>0</branch>
-<address>
<postalCode>22222</postalCode>
<city>IRAKLIO</city>
</address>
</counterpart>
and this is what I get so far:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<InvoiceDoc>
<invoice>
<issuer vatNumber="998380246" country="GR" branch="01"/>
<counterpart vatNumber="027052555" country="GR" branch="0">
<address postalcode="17342" city="AG. DIMITRIOS"/>
</counterpart>
and here is the code I use:
Code:
Get Create U_cXMLDOMDocument to hoXML
Get psFullXMLFilePath to sPath
EraseFile sPath
Set psDocumentName of hoXML to sPath
Set pbValidateOnParse of hoXML to True
Get LoadXMLDocument of hoXML to bOK
Get DocumentElement of hoXML to hoRoot
If not hoRoot Get CreateDocumentElement of hoXML "InvoiceDoc" to hoRoot
Get CreateChildProcessingInstruction of hoRoot "xml" 'version="1.0" encoding="UTF-8"' to hoNodeToInsert
If (hoNodeToInsert > 0) Begin
Get InsertBeforeNode of hoXML hoNodeToInsert hoRoot to hoInsertedNode
If ((hoInsertedNode <> hoNodeToInsert) and (hoInsertedNode > 0)) Begin
Send Destroy of hoInsertedNode
End
Send Destroy of hoNodeToInsert
End
// this doesn't work
Send AddAttribute of hoRoot "xmlns=" "http://www.aade.gr/myDATA/invoice/v1.0"
Send AddAttribute of hoRoot "xmlns:xsi=" "http://www.w3.org/2001/XMLSchema-instance"
Send AddAttribute of hoRoot "xsi:schemaLocation=" "http://www.aade.gr/myDATA/invoice/v1.0/InvoicesDoc-v0.6.xsd"
Send AddAttribute of hoRoot "xmlns:icls=" "http://www.w3.org/2001/XMLSchema-instance"
Send AddAttribute of hoRoot "xmlns:xsi=" "https://www.aade.gr/myDATA/incomeClassificaton/v1.0"
Send AddAttribute of hoRoot "xmlns:ecls=" "https://www.aade.gr/myDATA/expensesClassificaton/v1.0"
Get AddElement of hoRoot "invoice" "" to hoInvoice
Get AddElement of hoInvoice "issuer" "" to hoIssuer
Send AddAttribute of hoIssuer "vatNumber" "998380246"
Send AddAttribute of hoIssuer "country" "GR"
Send AddAttribute of hoIssuer "branch" "01"
Get AddElement of hoInvoice "counterpart" "" to hoCounterpart
Send AddAttribute of hoCounterpart "vatNumber" "027052555"
Send AddAttribute of hoCounterpart "country" "GR"
Send AddAttribute of hoCounterpart "branch" "0"
Get AddElement of hoCounterpart "address" "" to hoAddress
Send AddAttribute of hoAddress "postalcode" "17342"
Send AddAttribute of hoAddress "city" "AG. DIMITRIOS"
I am also getting an error when I try to verify the xml file through notepad++, the following lines are rejected, and I don't know how to output them either, how should I create the "icls:" under the incomeClassification tag?
Code:
<invoiceDetails>
<lineNumber>1</lineNumber>
<netValue>1000.00</netValue>
<vatCategory>1</vatCategory>
<vatAmount>240.00</vatAmount>
<discountOption>true</discountOption>
<incomeClassification>
<icls:classificationType>E3_561_001</icls:classificationType>
<icls:classificationCategory>category1_2</icls:classificationCategory>
<icls:amount>1000.00</icls:amount>
</incomeClassification>
</invoiceDetails>
I attached a sample xml file which is working, and the one I am creating based on that sample, which fails miserably.
Any help or sample on how to create these tags is greatly appreciated :-)
Thank you
Yannis