Xml element retrieval on xml with namespaces - e.g. cbc:UBLVersionID

Hello

I am trying to deactivate xml of an electronic invoice document, without problems in the deactivate activity, however at the moment of using
the for each is throwing errors at me, because the attachedDocument header has quotation marks and: what could I do to walk through
and show me the variables of the next element?

I need to store labels:

cbc:UBLVersionIDDIAN 2.1</cbc:UBLVersionID>
cbc:CustomizationIDDocumentos adjuntos</cbc:CustomizationID>
cbc:ProfileIDFactura Electrónica de Venta</cbc:ProfileID>
cbc:ProfileExecutionID1</cbc:ProfileExecutionID>
cbc:IDb3623387a57344cf93816a876b266c42</cbc:ID>
cbc:IssueDate2020-02-19</cbc:IssueDate>
cbc:IssueTime12:41:41-05:00</cbc:IssueTime>
cbc:DocumentTypeContenedor de Factura Electrónica</cbc:DocumentType>
cbc:ParentDocumentIDFVE3438</cbc:ParentDocumentID>
cac:SenderParty

errors

OutData.Elements("AttachedDocument xmlns:ext=“urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2” xmlns:cbc=“urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2” xmlns:cac=“urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2” xmlns=“urn:oasis:names:specification:ubl:schema:xsd:AttachedDocument-2”>
") in for each

or with OutData.Elements(“AttachedDocument xmlns:ext=”) in for each

Thank

@Fabian_DDD
Your XML has defined namespaces. Have a look here and find a xaml showcasing ion how to handle

Kindly note: your posted XML can onlyfully displayed if you use the grafik format button.

In case of you need more help, just share the xml file with us thanks

Hello,

I am reviewing but I cannot capture the cbc tags:

the complete document is this
Data1.xml (31.3 KB) because I cannot relate the cbc to any variable

@Fabian_DDD
Can you please confirm or tell your requirements. We do need to retrieve the values from
cbc:UBLVersion …SenderParty?

I will have a look on it later

if at the time of replacement

xDoc.Element("{urn:abou:documents:ka:Case}Case").Name.ToString for
xDoc.Element("{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}AttachedDocument").Name.ToString

error: “Log Message: Object reference not established as an instance of an object.”

If what I want is to get the value of some labels like

<cbc: UBLVersionID>
<cbc: ParentDocumentID>
<cbc: IssueDate>

etc.

ok I will start now give me some little time

@Fabian_DDD
Your XML was not valid. I repaired it with removing the last duplicated </AttachedDocument>

  • namespace was configured for CBC
  • CustomizationID was retrieved and logged for some items
  • from root direct children filtered by CBC namespace used in name was retrieved
  • iteration over the filtered children and logging local name and value

Result:
grafik

Find starter help here:
Fabian_DDD.xaml (7.8 KB)
Corrected XML
Data1.xml (32.3 KB)

It worked and I understood how to process the xml

Thank you

Hello
He was reviewing the result in more detail and I decided to remove the “where” filter in the main because it does not give me all the fields that I must capture:

image
Now, it is not very clear to me how I can get these fields if I no longer have a “where” statement

I am still missing these labels that I can not know because I am not classified

ValTolFac:######
cbc:Note###########################</cbc:Note>cbc:Note
cac:PaymentMeanscbc:ID2</cbc:ID>cbc:PaymentMeansCode3</cbc:PaymentMeansCode>cbc:PaymentDueDate2020-03-20</cbc:PaymentDueDate></cac:PaymentMeans>
cbc:Note1.######</cbc:Note>cbc:Note#######</cbc:Note>cbc:Note########</cbc:Note>
cbc:Percent19.00</cbc:Percent>
<cbc:UUID schemeID=“1” schemeName=“CUFE-SHA384”>bf7ec366f42414e6####</cbc:UUID>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.