web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Read XML values

(0) ShareShare
ReportReport
Posted on by 105

I want to read a xml file

 

<?xml version="1.0" encoding="UTF-8"?>
<ns3:MainContainer versione="FPR12" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2">
<ContainerHeader>
<DataTrasmit>
<IdTrasmit>
<IdCountry>IT</IdCountry>
</IdTrasmit>
</DataTrasmit>
</ContainerHeader>
</ns3:MainContainer>


 i try to read the "IT" value with 

 

"GetXML Element Value"

 

with path:

//ns3:MainContainer/ContainerHeader/DataTrasmit/IdTrasmit/IdCountry

 

but it not work.

In general the "path" does not work when ":" is present in the path

 

Why? 

 

 

  

 

 

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    This is because your XML contains namespaces. When that is the case, you need to use the local-name() function in your xpath.

     

    For your specific case, try the following xpath:

    //*[local-name()='IdCountry']/text()

    -------------------------------------------------------------------------

    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

     

  • paronchi Profile Picture
    105 on at

    Ok, but if i have this XML

     

    <?xml version="1.0" encoding="UTF-8"?><ns3:FatturaElettronica versione="FPR12" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2">
    <FatturaElettronicaHeader>
    <DatiTrasmissione>
    <IdTrasmittente>
    <IdPaese>IT</IdPaese>
    <IdCodice>00000000</IdCodice>
    </IdTrasmittente>
    <ProgressivoInvio>2023-D9116</ProgressivoInvio>
    <FormatoTrasmissione>FPR12</FormatoTrasmissione>
    <CodiceDestinatario>0000000</CodiceDestinatario>
    </DatiTrasmissione>
    <CedentePrestatore>
    <DatiAnagrafici>
    <IdFiscaleIVA>
    <IdPaese>IT</IdPaese>
    <IdCodice>000000000</IdCodice>
    </IdFiscaleIVA>
    <CodiceFiscale>11111111</CodiceFiscale>
    <Anagrafica>
    <Denominazione>pinco pallino</Denominazione>
    </Anagrafica>
    <RegimeFiscale>RF01</RegimeFiscale>
    </DatiAnagrafici>
    <Sede>
    <Indirizzo>VIA QUI</Indirizzo>
    <NumeroCivico>10/12</NumeroCivico>
    <CAP>20123</CAP>
    <Comune>Milano</Comune>
    <Provincia>MI</Provincia>
    <Nazione>IT</Nazione>
    </Sede>
    </CedentePrestatore>
    <CessionarioCommittente>
    <DatiAnagrafici>
    <IdFiscaleIVA>
    <IdPaese>IT</IdPaese>
    <IdCodice>000000000</IdCodice>
    </IdFiscaleIVA>
    <Anagrafica>
    <Denominazione>Sempronio</Denominazione>
    </Anagrafica>
    </DatiAnagrafici>
    <Sede>
    <Indirizzo>Via vai 4</Indirizzo>
    <CAP>20124</CAP>
    <Comune>Milano</Comune>
    <Provincia>MI</Provincia>
    <Nazione>IT</Nazione>
    </Sede>
    </CessionarioCommittente>
    </FatturaElettronicaHeader>
    <FatturaElettronicaBody>
    <DatiGenerali>
    <DatiGeneraliDocumento>
    <TipoDocumento>TD01</TipoDocumento>
    <Divisa>EUR</Divisa>
    <Data>2023-08-01</Data>
    <Numero>ADF-DESWA</Numero>
    <ImportoTotaleDocumento>9.90</ImportoTotaleDocumento>
    </DatiGeneraliDocumento>
    </DatiGenerali>
    <DatiBeniServizi>
    <DettaglioLinee>
    <NumeroLinea>1</NumeroLinea>
    <Descrizione>ASD</Descrizione>
    <DataInizioPeriodo>2023-07-01</DataInizioPeriodo>
    <DataFinePeriodo>2023-07-31</DataFinePeriodo>
    <PrezzoUnitario>1.00</PrezzoUnitario>
    <PrezzoTotale>2.00</PrezzoTotale>
    <AliquotaIVA>3.00</AliquotaIVA>
    </DettaglioLinee>
    <DatiRiepilogo>
    <AliquotaIVA>3.00</AliquotaIVA>
    <ImponibileImporto>1.00</ImponibileImporto>
    <Imposta>1.0</Imposta>
    </DatiRiepilogo>
    </DatiBeniServizi>
    </FatturaElettronicaBody>
    </ns3:FatturaElettronica>

     

    and read value with

    //*[local-name()='CAP']/text()

    I find two results

     

    00063

    20124

     

    How do I get their path?

     

     

     

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Use the Execute XPath expression action and get the parents instead. Use the following XPath:

    //*[local-name()='Sede']

    This will result in a list of XML nodes. You can then process them in a loop to get the specific values of each child within the parent.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard