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

  • Home
  • SEARCH
  • 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 6947829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:44:37+00:00 2026-05-27T13:44:37+00:00

I what to retrieve a string representation of the xml fragment for the HB_Base

  • 0

I what to retrieve a string representation of the xml fragment for the HB_Base element. Could anyone point it out the best way.

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://www.as.com/ver/ver.IClaimver/Car</a:Action>
    <a:MessageID>urn:uuid:b22149b6-2e70-46aa-8b01-c2841c70c1c7</a:MessageID>
    <ActivityId CorrelationId="16b385f3-34bd-45ff-ad13-8652baeaeb8a" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">04eb5b59-cd42-47c6-a946-d840a6cde42b</ActivityId>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">http://localhost/ver.Web/ver2011.svc</a:To>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Car xmlns="http://www.as.com/ver">
      <carApplication>
        <HB_Base xsi:type="HB" xmlns="urn:core">
          <Header>
            <Advisor>
              <AdvisorLocalAuthorityCode>11</AdvisorLocalAuthorityCode>
              <AdvisorType>1</AdvisorType>
            </Advisor>
          </Header>
          <General>
            <ApplyForHB>yes</ApplyForHB>
            <ApplyForCTB>yes</ApplyForCTB>
            <ApplyForFSL>yes</ApplyForFSL>
            <ConsentSupplied>no</ConsentSupplied>
            <SupportingDocumentsSupplied>no</SupportingDocumentsSupplied>
          </General>
        </HB_Base>
      </carApplication>
    </Car>
  </s:Body>
</s:Envelope>

Update

How to use XmlDocument.SelectSingleNode() that uses XmlNamespaceManager. Because it might be better to use xpath like "/Envelope/Body/Car/carApplication/HB_Base"

  • 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-05-27T13:44:37+00:00Added an answer on May 27, 2026 at 1:44 pm

    You need to specify the namespace, using XLinq we’d use an XNamespace to help make the XName which refers to the elements:

    var xdoc = XDocument.Load(xmlFile); // or .Parse(@"....")
    
    XNamespace ns = @"urn:core";
    // This is where the magic happens: ns + "HB_Base"
    var hbBase = xdoc.Root.Descendants(ns + "HB_Base")
                          .SingleOrDefault();
    
    if (hbBase == null) throw new InvalidOperationException("No such element");
    
    var xml = hbBase.ToString();
    

    Using XmlDocument and XmlNamespaceManager instead:

    var xmlDoc = new XmlDocument();
    xmlDoc.Load(xmlFile);
    
    var nsManager = new XmlNamespaceManager(xmlDoc.NameTable);
    nsManager.AddNamespace("s", @"http://www.w3.org/2003/05/soap-envelope");
    nsManager.AddNamespace("c", @"http://www.as.com/ver");
    nsManager.AddNamespace("h", @"urn:core");
    
    var hbBase = xmlDoc.SelectSingleNode(
        @"/s:Envelope/s:Body/c:Car/c:carApplication/h:HB_Base");
    if (hbBase == null) throw new InvalidOperationException("No such element");
    
    var xml = hbBase.OuterXml;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How might one retrieve the last element of a string array in visual basic
I want to retrieve the consecutive 8 digits out of a string. hello world,12345678anything
I am using print_r(debug_backtrace(), true) to retrieve a string representation of the debug backtrace.
From my backend I retrieve a string that contains some xml data. When i
llvm::Type 2.9 and earlier used to have getDescription method to retrieve a string representation
Is there a way to retrieve a string from an ArrayList if we know
Example string $string = 'how-do-i-retrieve-last-word' $string = 'how-do-i-retrieve-last-word-2' $string = 'how-do-i retrieve-last word-123' $string
'123xswer' How to retrieve 123 from the string above without using regular expression?
I have a coded string that I'd like to retrieve a value from. I
Let's say I have a string that I retrieve from a DB like: Lorem

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.