Taking as a list from xml file

Hello,
At UBL file there is multiple line as InvoiceLine. I need to take them as a list. Anyone can help?

Hi @Basak_Demirel_Kacmaz ,

Do you have the string text and you have to make them a list. Please provide us more information

HAPPY AUTOMATION !!!

BR,
Krishna

@Basak_Demirel_Kacmaz

Check below post for your reference

Hope this helps you

Thanks

cac:InvoiceLine
cbc:ID9</cbc:ID>
<cbc:Note />
<cbc:InvoicedQuantity unitCode=“C62”>1</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID=“TRY”>71.50</cbc:LineExtensionAmount>
cac:TaxTotal
<cbc:TaxAmount currencyID=“TRY”>0.00</cbc:TaxAmount>
cac:TaxSubtotal
<cbc:TaxableAmount currencyID=“TRY”>71.50</cbc:TaxableAmount>
<cbc:TaxAmount currencyID=“TRY”>0.00</cbc:TaxAmount>
cbc:CalculationSequenceNumeric1</cbc:CalculationSequenceNumeric>
cbc:Percent0</cbc:Percent>
cac:TaxCategory
cac:TaxScheme
cbc:NameKDV</cbc:Name>
cbc:TaxTypeCode0015</cbc:TaxTypeCode>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
cac:Item
cbc:Descriptionaa
PVC</cbc:Description>
cbc:Nameaa</cbc:Name>
cbc:BrandNameCETAFORM</cbc:BrandName>
cac:BuyersItemIdentification
<cbc:ID />
</cac:BuyersItemIdentification>
cac:SellersItemIdentification
cbc:IDCETA-E66-44-0140</cbc:ID>
</cac:SellersItemIdentification>
cac:ManufacturersItemIdentification
cbc:ID8691486800264</cbc:ID>
</cac:ManufacturersItemIdentification>
</cac:Item>
cac:Price
<cbc:PriceAmount currencyID=“TRY”>7.50</cbc:PriceAmount>
</cac:Price>
</cac:InvoiceLine>

It is an xml file and part of it like this. And there is multiple element including invoiceline. I need to extract each other.
Hope I can explain clearly.

Hi,

Here is the complete information you need, please try all the steps mentioned in the link and let us know if you need further information.

HAPPY AUTOMATION !!!

BR,
Krishna

Similar to your other topic you need to handle the XML Namespaces:

with an e.g. Descendants(Namespacevar + “InvoiceLine”) or other parent elements, the specific elements can be grabbed and e.g later processed within a loop.

Kindly note: when sharing XML snippets please use always the the format button </>.
If possible share the xml file as well

Hi,

one of my project i have invoice details in xml and i have to extract the invoice details and input those details into ERP application.

For the above requirement i have achieved through below simple steps.

  1. Use one simple assign activity to instantiate the Data set.

image

create ds variable type system.data.dataset

  1. Use invoke method activity → Method name: Read Xml

input → We have to provide file path as one of the parameter.

please refer the below image. it would help us to convert our xml into multiple data tables.

image

  1. User for each loop to loop all the data tables like below. in that for each loop add one more for each row to loop the xml tables.

  1. use the if condition to check the xml table name

eg: if XMLTableName=’'cac:InvoiceLine"

row(“cbc:ID”).ToString

try the above steps for your xml and see whether you are able to retrieve the data or not. thanks.

1 Like


It throws an error like that. What should I do?
Thanks for help

it seems the child tags are same for two parent tags that’s why the vb.net function cannot create data tables. even i am having nested xml tables but the child tags will be different. I am sorry not sure the suggested method will work in your case. is there any chance you could share the sample xml.

Could you please follow other suggestions provided by our fellow forum members. mean while i will also try solution for this error. thanks.

1 Like

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