Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:37:51+00:00 2026-06-06T00:37:51+00:00

I have this xml from which I am trying to grab the value in

  • 0

I have this xml from which I am trying to grab the value in the node <ErrorCode> after investigating, i found it easier to use XDocument because it cleans any unwanted \r\n that the response from an api was giving me.. but now I am not sure how to retrieve that value using XDocument

<PlatformResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://platform.intuit.com/api/v1">
  <ErrorMessage>OAuth Token rejected</ErrorMessage>
  <ErrorCode>270</ErrorCode>
  <ServerTime>2012-06-19T03:53:34.4558857Z</ServerTime>
</PlatformResponse>

I want to be able to take advantage of this call to get the value

 XDocument xmlResponse = XDocument.Parse(response);

I can’t use XmlDocument because it does not clean the XML as it is doing it XDocument

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:37:52+00:00Added an answer on June 6, 2026 at 12:37 am

    Since you have defined the Namespace, try the following code:

        XDocument xmlResponse = XDocument.Load("yourfile.xml");
        //Or you can use XDocument xmlResponse = XDocument.Parse(response)
        XNamespace ns= "http://platform.intuit.com/api/v1";
        var test = xmlResponse.Descendants(ns+ "ErrorCode").FirstOrDefault().Value;
    

    Or if you don’t want to use Namespace then:

        var test3 = xmlResponse.Descendants()
                    .Where(a => a.Name.LocalName == "ErrorCode")
                    .FirstOrDefault().Value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to format a table from XML. Lets say I have this line
I have the following XML from which I am trying to generate HTML files.
I am trying to return the the attribute values from this XML, which is
please help me to parse xml from another xml... i have this xml named
Currently, I have this version of the autocomplete control working when returning XML from
I have this code that reads from XML file. It gets five strings (groupId,
I have a simple problem with XML got from database. Now, this XML can
I have this data from a xml file: <?xml version=1.0 encoding=utf-8 ?> <words> <id>...</id>
this is my situation: I have two org.w3c.dom.Document created from two xml files. What
Ok, I am back on this task. I have my XML properly download from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.