Read xml file

Hello,

I am new to n8n, I have a quick question please

I have xml files locally, and I want to read these files.
how to do it please?

Hey @Nabil_Touijer!

Welcome to the community!

Firstly, since this is a question I am moving this post to the questions category. To answer your question, you can use the Read Binary File node to read the local file.

Hope this helps :slightly_smiling_face:

thank you for your reply

I am using the binary read file, but I want to manipulate the XML data
I can’t see the data

You can have a look at this workflow:

It shows how you convert XML to JSON. The only difference is that it gets the file from Dropbox instead of the local filesystem.

Thanks Jan

Hi, I con’t read this file. I see option of file but I dont see content body. Can You told me why?




This is XML content:

<?xml version="1.0"?>
<ImpulsEdiMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <StandardBusinessDocumentHeader>
    <HeaderVersion>1</HeaderVersion>
    <DocumentIdentification>
      <Standard>IMPULS.EDI</Standard>
      <DocumentMessage>InvoiceMessage</DocumentMessage>
      <DocumentMessageVersion>1.0</DocumentMessageVersion>
      <CreationDateAndTime>2022-10-04T08:42:19.7170056+02:00</CreationDateAndTime>
    </DocumentIdentification>
  </StandardBusinessDocumentHeader>
  <InvoiceMessage>
    <EntityIdentification>
      <EntityId>FV/000020/10/22</EntityId>
      <OwnerGln>5907524060006</OwnerGln>
      <ImpulsDocumentTypeId>60</ImpulsDocumentTypeId>
    </EntityIdentification>
    <InvoiceHeader>
      <InvoiceNumber>FV/000020/10/22</InvoiceNumber>
      <InvoiceDate>2022-10-03T00:00:00</InvoiceDate>
      <SalesDate>2022-10-03T00:00:00</SalesDate>
      <DuplicateDate xsi:nil="true" />
      <InvoiceCurrency>PLN</InvoiceCurrency>
      <InvoicePaymentDueDate>2022-11-02T00:00:00</InvoicePaymentDueDate>
      <InvoicePaymentTerms>30</InvoicePaymentTerms>
      <ImpulsPaymentMethodCode>1</ImpulsPaymentMethodCode>
      <SplitPayment>N</SplitPayment>
      <InvoicePostDate xsi:nil="true" />
      <ImpulsDocumentFunctionCode>O</ImpulsDocumentFunctionCode>
      <Delivery>
        <ImpulsDeliveryMethodCode>10</ImpulsDeliveryMethodCode>
        <DeliveryInstructions>Transport lądowy</DeliveryInstructions>
        <ShipToGLN>5907468153680</ShipToGLN>
        <Address>
          <Name>STOKROTKA CENTRUM DYSTRYBUCYJNE LUBLIN</Name>
          <StreetAndNumber>Erazma Plewińskiego 18</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20 - 2</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <IncotermsDeliveryCode>DAP</IncotermsDeliveryCode>
      </Delivery>
      <Buyer>
        <GLN>5907468149942</GLN>
        <Address>
          <Name>"STOKROTKA" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Projektowa 1</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20-209</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>7121008323</TaxId>
      </Buyer>
      <Payer>
        <GLN>5907468149942</GLN>
        <Address>
          <Name>"STOKROTKA" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Projektowa 1</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20-209</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>7121008323</TaxId>i
      </Payer>
      <Invoicee>
        <GLN>5907468149942</GLN>
        <Address>
          <Name>"STOKROTKA" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Projektowa 1</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20-209</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>7121008323</TaxId>
      </Invoicee>
      <Seller>
        <GLN>5907524060006</GLN>
        <Address>
          <Name>ZAKŁAD PRZEMYSŁU MIĘSNEGO BIERNACKI SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Dworcowa 47D</StreetAndNumber>
          <City>Golina</City>
          <PostalCode>63-200</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>6172148186</TaxId>
        <AccountNumber>PL50 1140 1993 0000 5212 7800 1033</AccountNumber>
        <CodeByBuyer>187023</CodeByBuyer>
      </Seller>
      <Payee>
        <GLN>5907524060006</GLN>
        <Address>
          <Name>ZAKŁAD PRZEMYSŁU MIĘSNEGO BIERNACKI SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Dworcowa 47D</StreetAndNumber>
          <City>Golina</City>
          <PostalCode>63-200</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>6172148186</TaxId>
        <AccountNumber>PL50 1140 1993 0000 5212 7800 1033</AccountNumber>
      </Payee>
      <SellerHeadquarters>
        <GLN>5907524060006</GLN>
        <Address>
          <Name>ZAKŁAD PRZEMYSŁU MIĘSNEGO BIERNACKI SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Dworcowa 47D</StreetAndNumber>
          <City>Golina</City>
          <PostalCode>63-200</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>6172148186</TaxId>
      </SellerHeadquarters>
      <OrderedBy>
        <GLN>5907468149942</GLN>
        <Address>
          <Name>"STOKROTKA" SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Projektowa 1</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20-209</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>7121008323</TaxId>
      </OrderedBy>
      <Sender>
        <GLN>5907524060006</GLN>
        <Address>
          <Name>ZAKŁAD PRZEMYSŁU MIĘSNEGO BIERNACKI SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ</Name>
          <StreetAndNumber>ul. Dworcowa 47D</StreetAndNumber>
          <City>Golina</City>
          <PostalCode>63-200</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>6172148186</TaxId>
      </Sender>
      <Receiver>
        <GLN>5907468153680</GLN>
        <Address>
          <Name>STOKROTKA CENTRUM DYSTRYBUCYJNE LUBLIN</Name>
          <StreetAndNumber>Erazma Plewińskiego 18</StreetAndNumber>
          <City>Lublin</City>
          <PostalCode>20 - 2</PostalCode>
          <CountryCode>PL</CountryCode>
        </Address>
        <TaxId>7121008323</TaxId>
      </Receiver>
    </InvoiceHeader>
    <InvoiceLines>
      <InvoiceLine>
        <LineItem>
          <LineNumber>1</LineNumber>
          <ItemIdentification>
            <GTIN>2292060</GTIN>
            <BuyerIndexCode>96434</BuyerIndexCode>
            <BuyerIndexName>UDZIEC WOŁOWY BEZ KOŚCI VAC</BuyerIndexName>
            <CommercialVersion>52222820</CommercialVersion>
            <SupplierIndexCode>05060291</SupplierIndexCode>
            <SupplierIndexName>UDZIEC WOŁOWY BEZ KOŚCI VAC</SupplierIndexName>
          </ItemIdentification>
          <UnitOfMeasure>kg</UnitOfMeasure>
          <InvoiceUnitPacksize xsi:nil="true" />
          <Quantity>
            <InvoiceQuantity>39.38</InvoiceQuantity>
            <DeliveredQuantity xsi:nil="true" />
          </Quantity>
          <InvoicePriceWithAmounts>
            <TaxAmount>0</TaxAmount>
            <NetAmount>1240.47</NetAmount>
            <InvoiceUnitNetPrice>31.50</InvoiceUnitNetPrice>
            <InvoiceUnitGrossPrice>31.50</InvoiceUnitGrossPrice>
            <InvoiceUnitRetailPrice>31.50</InvoiceUnitRetailPrice>
          </InvoicePriceWithAmounts>
          <InvoiceDepositAmount xsi:nil="true" />
          <TaxCategory>
            <Rate>0</Rate>
            <CategoryCode>S</CategoryCode>
          </TaxCategory>
          <PKWiUCode>10.11.11.0</PKWiUCode>
          <CnCode>02013000</CnCode>
          <PreviousDepositAmount xsi:nil="true" />
          <ExpirationDate xsi:nil="true" />
          <ProductionDate xsi:nil="true" />
          <UtilizationFeeAmount>0</UtilizationFeeAmount>
        </LineItem>
        <LineOrders>
          <ReferencedOrder>
            <BuyerOrderNumber>215059/2022</BuyerOrderNumber>
            <SupplierOrderNumber>ZKK_B/1416/09/22</SupplierOrderNumber>
            <BuyerOrderDate>2022-09-29T00:00:00</BuyerOrderDate>
            <OrderLineNumber>1</OrderLineNumber>
          </ReferencedOrder>
        </LineOrders>
        <LineDespatches>
          <ReferencedDespatch>
            <DespatchNumber>WZ/5996/26/N</DespatchNumber>
            <DespatchDocumentDate>2022-10-01T00:00:00</DespatchDocumentDate>
            <DeliveryDate xsi:nil="true" />
          </ReferencedDespatch>
        </LineDespatches>
      </InvoiceLine>
      <InvoiceLine>
        <LineItem>
          <LineNumber>2</LineNumber>
          <ItemIdentification>
            <GTIN>2990670</GTIN>
            <BuyerIndexCode>34318</BuyerIndexCode>
            <BuyerIndexName>WOŁOWINA BEZ KOŚCI VAC</BuyerIndexName>
            <CommercialVersion>52222821</CommercialVersion>
            <SupplierIndexCode>05010551</SupplierIndexCode>
            <SupplierIndexName>WOŁOWINA BEZ KOŚCI VAC</SupplierIndexName>
          </ItemIdentification>
          <UnitOfMeasure>kg</UnitOfMeasure>
          <InvoiceUnitPacksize xsi:nil="true" />
          <Quantity>
            <InvoiceQuantity>115.3</InvoiceQuantity>
            <DeliveredQuantity xsi:nil="true" />
          </Quantity>
          <InvoicePriceWithAmounts>
            <TaxAmount>0</TaxAmount>
            <NetAmount>3251.46</NetAmount>
            <InvoiceUnitNetPrice>28.20</InvoiceUnitNetPrice>
            <InvoiceUnitGrossPrice>28.20</InvoiceUnitGrossPrice>
            <InvoiceUnitRetailPrice>28.20</InvoiceUnitRetailPrice>
          </InvoicePriceWithAmounts>
          <InvoiceDepositAmount xsi:nil="true" />
          <TaxCategory>
            <Rate>0</Rate>
            <CategoryCode>S</CategoryCode>
          </TaxCategory>
          <PKWiUCode>10.11.11.0</PKWiUCode>
          <CnCode>02013000</CnCode>
          <PreviousDepositAmount xsi:nil="true" />
          <ExpirationDate xsi:nil="true" />
          <ProductionDate xsi:nil="true" />
          <UtilizationFeeAmount>0</UtilizationFeeAmount>
        </LineItem>
        <LineOrders>
          <ReferencedOrder>
            <BuyerOrderNumber>215059/2022</BuyerOrderNumber>
            <SupplierOrderNumber>ZKK_B/1416/09/22</SupplierOrderNumber>
            <BuyerOrderDate>2022-09-29T00:00:00</BuyerOrderDate>
            <OrderLineNumber>2</OrderLineNumber>
          </ReferencedOrder>
        </LineOrders>
        <LineDespatches>
          <ReferencedDespatch>
            <DespatchNumber>WZ/5996/26/N</DespatchNumber>
            <DespatchDocumentDate>2022-10-01T00:00:00</DespatchDocumentDate>
            <DeliveryDate xsi:nil="true" />
          </ReferencedDespatch>
        </LineDespatches>
      </InvoiceLine>
    </InvoiceLines>
    <InvoiceSummary>
      <TotalLines>2</TotalLines>
      <TotalAmountsSummary>
        <TotalNetAmount>4491.93</TotalNetAmount>
        <TotalTaxableBasis>4491.93</TotalTaxableBasis>
        <TotalTaxAmount>0</TotalTaxAmount>
        <TotalGrossAmount>4491.93</TotalGrossAmount>
      </TotalAmountsSummary>
      <TaxSummary>
        <TaxSummaryLines>
          <TaxSummaryLine>
            <Tax>
              <TaxCategory>
                <Rate>0</Rate>
                <CategoryCode>S</CategoryCode>
              </TaxCategory>
              <TaxAmount>0</TaxAmount>
              <TaxableBasis>4491.93</TaxableBasis>
              <TaxableAmount>4491.93</TaxableAmount>
              <GrossAmount>4491.93</GrossAmount>
            </Tax>
            <CorrectionTaxAmount xsi:nil="true" />
            <CorrectionTaxableBasis xsi:nil="true" />
          </TaxSummaryLine>
        </TaxSummaryLines>
      </TaxSummary>
    </InvoiceSummary>
  </InvoiceMessage>
</ImpulsEdiMessage>

Hi @Krystian_Klopocki, welcome to the community!

This is a rather old thread and n8n has changed a lot over the last two years. From your screenshot it also seems you are using a rather old version of n8n. So, in a first step you might want to upgrade to the latest available n8n version.

With the current version of n8n you could read an XML file like so:

In this example I am downloading a dummy XML file rather than reading it from a hard drive. The logic should, however, be the same. The file content is read using the Move Binary Data node which appears to be missing from your screenshot. Afterwards the XML node can process the data as expected:

Hope this helps! If you’re still running into any trouble here, could you open a new topic and provide the information requested in the template when doing so? Thank you so much :slight_smile: