- Mar
- 26
- 0
I am confused about using XML parsing. The appended file (which is in fact an xml file) represents an electronic invoice used in my country starting by this year.
I am trying to extract some info from that file. Such as the string 53484421 which is the tax ID.
I am using the TCC console :
<<echo %@XMLHASXPATH[cac:AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID]>> returns 1.
Instead @XMLXPATH returns <<TCC: No such child.>> Quite annoying.
But the surprise comes (at least for me). I was accidentally set a mistaken path : @XMLXPATH[/AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID] which returns an error <<TCC: Top element does not match..>> Right after that I have made the same inquiry on the correct path [cac:AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID] which returns me the expected string !
Again : @XMLOPEN - @XMLXPATH (correct path ) returns error 208. But @XMLOPEN - @XMLXPATH (wrong path) with the normal error - followed by @XMLXPATH (correct path) returns the string.
These are two sequencies quite strange.
Another situation. In a batch file.
set a=%@XMLOPEN[file.xml]
set t=%@XMLHASXPATH[path-one]
if %t EQ 1 set CAR1=%@XMLXPATH[path-one]
if %t EQ 2 set CAR1=%@XMLXPATH[path-two]
I never succeded to get a result, only error. Error 208 : No such child. Even if the answer for %t% was 1.
I suppose I am wrong somewhere. Does anyone know which is my mistake, please ?
Thank you,
Florin
I am trying to extract some info from that file. Such as the string 53484421 which is the tax ID.
I am using the TCC console :
<<echo %@XMLHASXPATH[cac:AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID]>> returns 1.
Instead @XMLXPATH returns <<TCC: No such child.>> Quite annoying.
But the surprise comes (at least for me). I was accidentally set a mistaken path : @XMLXPATH[/AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID] which returns an error <<TCC: Top element does not match..>> Right after that I have made the same inquiry on the correct path [cac:AccountingCustomerParty/Party/PartyTaxScheme/cbc:CompanyID] which returns me the expected string !
Again : @XMLOPEN - @XMLXPATH (correct path ) returns error 208. But @XMLOPEN - @XMLXPATH (wrong path) with the normal error - followed by @XMLXPATH (correct path) returns the string.
These are two sequencies quite strange.
Another situation. In a batch file.
set a=%@XMLOPEN[file.xml]
set t=%@XMLHASXPATH[path-one]
if %t EQ 1 set CAR1=%@XMLXPATH[path-one]
if %t EQ 2 set CAR1=%@XMLXPATH[path-two]
I never succeded to get a result, only error. Error 208 : No such child. Even if the answer for %t% was 1.
I suppose I am wrong somewhere. Does anyone know which is my mistake, please ?
Thank you,
Florin