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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to access XML node

(1) ShareShare
ReportReport
Posted on by 107
<Estimate domain="QBO" sparse="false">
            <Id>151</Id>
            <SyncToken>0</SyncToken>
            <MetaData>
                <CreateTime>2025-01-10T00:19:29-08:00</CreateTime>
                <LastUpdatedTime>2025-01-10T00:19:29-08:00</LastUpdatedTime>
            </MetaData>
            <DocNumber>1004</DocNumber>
            <TxnDate>2025-01-10</TxnDate>
            <CurrencyRef name="United States Dollar">USD</CurrencyRef>
            <TxnStatus>Pending</TxnStatus>
            <Line>
                <Id>1</Id>
                <LineNum>1</LineNum>
                <Description>Pest Control Services</Description>
                <Amount>35.00</Amount>
                <DetailType>SalesItemLineDetail</DetailType>
                <SalesItemLineDetail>
                    <ItemRef name="Pest Control:Pest Control">10</ItemRef>
                    <UnitPrice>35</UnitPrice>
                    <Qty>1</Qty>
                    <ItemAccountRef name="Pest Control Services">54</ItemAccountRef>
                    <TaxCodeRef>NON</TaxCodeRef>
                </SalesItemLineDetail>
            </Line>
            <Line>
                <Amount>35.00</Amount>
                <DetailType>SubTotalLineDetail</DetailType>
                <SubTotalLineDetail/>
            </Line>
            <Line>
                <Amount>3.50</Amount>
                <DetailType>DiscountLineDetail</DetailType>
                <DiscountLineDetail>
                    <PercentBased>true</PercentBased>
                    <DiscountPercent>10</DiscountPercent>
                    <DiscountAccountRef name="Discounts given">86</DiscountAccountRef>
                </DiscountLineDetail>
            </Line>
            <TxnTaxDetail>
                <TotalTax>0</TotalTax>
            </TxnTaxDetail>
            <CustomerRef name="Cool Cars">3</CustomerRef>
            <CustomerMemo>Thank you for your business and have a great day!</CustomerMemo>
            <BillAddr>
                <Id>105</Id>
                <Line1>65 Ocean Dr.</Line1>
                <City>Half Moon Bay</City>
                <CountrySubDivisionCode>CA</CountrySubDivisionCode>
                <PostalCode>94213</PostalCode>
            </BillAddr>
            <ShipAddr>
                <Id>106</Id>
                <Line1>65 Ocean Dr.</Line1>
                <City>Half Moon Bay</City>
                <CountrySubDivisionCode>CA</CountrySubDivisionCode>
                <PostalCode>94213</PostalCode>
            </ShipAddr>
            <FreeFormAddress>true</FreeFormAddress>
            <ShipFromAddr>
                <Id>107</Id>
                <Line1>123 Sierra Way</Line1>
                <Line2>San Pablo, CA  87999</Line2>
            </ShipFromAddr>
            <TotalAmt>31.50</TotalAmt>
            <ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
            <PrintStatus>NeedToPrint</PrintStatus>
            <EmailStatus>NotSet</EmailStatus>
            <BillEmail>
                <Address>Cool_Cars@intuit.com</Address>
            </BillEmail>
        </Estimate>

This is My XML file (Code).

There will be multiple estimate Node and Each Estimate node have various no. of Line node.

Now I want to iterate through each line (Green highlighted on above XML code) of each node How Can I do?

For that I did below method but it's not working. 



What is an issue here or How Can I do it?
I have the same question (0)
  • Suggested answer
    Alexander Drogin Profile Picture
    262 on at
    How to access XML node
    Is this the complete XML document? In this sample, Estimate is the root element, so the rootElement points to Estimate, and GetChildNodes returns the list of all nodes under it.
    If there are multiple "Estimate" nodes without any element above it in the hierarchy, then this is not a well-formed XML.
  • Suketu Piprotar Profile Picture
    107 on at
    How to access XML node
    Hello @Alexander Drogin

    This is Complete XML Document.

    <Response>
        <Estimate domain="QBO" sparse="false">

                <Id>151</Id>
                <SyncToken>0</SyncToken>
                <MetaData>
                    <CreateTime>2025-01-10T00:19:29-08:00</CreateTime>
                    <LastUpdatedTime>2025-01-10T00:19:29-08:00</LastUpdatedTime>
                </MetaData>
                <DocNumber>1004</DocNumber>
                <TxnDate>2025-01-10</TxnDate>
                <CurrencyRef name="United States Dollar">USD</CurrencyRef>
                <TxnStatus>Pending</TxnStatus>
                <Line>
                    <Id>1</Id>
                    <LineNum>1</LineNum>
                    <Description>Pest Control Services</Description>
                    <Amount>35.00</Amount>
                    <DetailType>SalesItemLineDetail</DetailType>
                    <SalesItemLineDetail>
                        <ItemRef name="Pest Control:Pest Control">10</ItemRef>
                        <UnitPrice>35</UnitPrice>
                        <Qty>1</Qty>
                        <ItemAccountRef name="Pest Control Services">54</ItemAccountRef>
                        <TaxCodeRef>NON</TaxCodeRef>
                    </SalesItemLineDetail>
                </Line>
                <Line>
                    <Amount>35.00</Amount>
                    <DetailType>SubTotalLineDetail</DetailType>
                    <SubTotalLineDetail/>
                </Line>
                <Line>
                    <Amount>3.50</Amount>
                    <DetailType>DiscountLineDetail</DetailType>
                    <DiscountLineDetail>
                        <PercentBased>true</PercentBased>
                        <DiscountPercent>10</DiscountPercent>
                        <DiscountAccountRef name="Discounts given">86</DiscountAccountRef>
                    </DiscountLineDetail>
                </Line>
                <TxnTaxDetail>
                    <TotalTax>0</TotalTax>
                </TxnTaxDetail>
                <CustomerRef name="Cool Cars">3</CustomerRef>
                <CustomerMemo>Thank you for your business and have a great day!</CustomerMemo>
                <BillAddr>
                    <Id>105</Id>
                    <Line1>65 Ocean Dr.</Line1>
                    <City>Half Moon Bay</City>
                    <CountrySubDivisionCode>CA</CountrySubDivisionCode>
                    <PostalCode>94213</PostalCode>
                </BillAddr>
                <ShipAddr>
                    <Id>106</Id>
                    <Line1>65 Ocean Dr.</Line1>
                    <City>Half Moon Bay</City>
                    <CountrySubDivisionCode>CA</CountrySubDivisionCode>
                    <PostalCode>94213</PostalCode>
                </ShipAddr>
                <FreeFormAddress>true</FreeFormAddress>
                <ShipFromAddr>
                    <Id>107</Id>
                    <Line1>123 Sierra Way</Line1>
                    <Line2>San Pablo, CA  87999</Line2>
                </ShipFromAddr>
                <TotalAmt>31.50</TotalAmt>
                <ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>
                <PrintStatus>NeedToPrint</PrintStatus>
                <EmailStatus>NotSet</EmailStatus>
                <BillEmail>
                    <Address>Cool_Cars@intuit.com</Address>
                </BillEmail>
            </Estimate>
          <Estimate>
           ....................
          </Estimate>
     </Response>
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,137 Super User 2025 Season 2 on at
    How to access XML node
  • Alexander Drogin Profile Picture
    262 on at
    How to access XML node
    With the full XML, this code should work. And what is wrong with it? How is it not working?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,237

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,425

#3
Sumit Singh Profile Picture

Sumit Singh 2,907

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans