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 229337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:45:27+00:00 2026-05-11T19:45:27+00:00

New to XML. I have a 3rd party webservice that supplies an XML document

  • 0

New to XML. I have a 3rd party webservice that supplies an XML document that I have to update the element values and pass back. The core issue issue is I get an NullReferenceException error when calling the node.RemoveAll() method in the code below. I’m calling the RemoveAll() method because each element has the xsi:nil attribute when it is supplied to me, and if I don’t remove it before updating the element value, the XML won’t validate by the webservice.

The XML document supplied by the 3rd party webservice is as follows:

<?xml version="1.0" encoding="utf-16"?>
<TaskData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schema.sample.com/application/1/520800B">
  <Global>
    <RequestInfo xmlns="http://schema.sample.com/application/1/Types">
      <Requestor xsi:nil="true" />
      <Date_init xsi:nil="true" />
      <Shipto xsi:nil="true" />
      <Customer xsi:nil="true" />
      <Contact xsi:nil="true" />
      <Requestor_Email xsi:nil="true" />      
    </RequestInfo>    
   </Global>
  </TaskData>

Other solutions I’ve seen have used the XmlNamespaceManager, but I haven’t been able to make it work. This xml document has a namespace specified for the TaskData element, and a different namespace for the RequestInfo element. I tried specifying the XmlNamespaceManager variable for each namespace, but got the same results….hovering over the nsmgr variable while in break mode reveals that the “children could not be evaluated” and that the DefaultNamespace property is an empty string.

Public Sub testxml()

    Dim doc As New XmlDocument
    doc.Load("c:\temp\sample.xml")

    Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
    nsmgr.AddNamespace("s", "http://schema.sample.com/application/1/520800B")

    Dim node As XmlNode = doc.SelectSingleNode("s:Requestor", nsmgr)
    node.RemoveAll()
    node.InnerText = "Your Name Goes Here"

    doc.Save("c:\temp\sample.xml")

End Sub
  • 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-11T19:45:27+00:00Added an answer on May 11, 2026 at 7:45 pm

    The problem is with this statement:

    doc.SelectSingleNode("s:Requestor", nsmgr)
    

    what you need to do is

    doc.SelectSingleNode("//s:Requestor",nsmgr)
    

    “s:Requestor” means give me the node underneath the current node name s:Requestor

    “//s:Requestor” means give me all nodes in the document named s:Requestor

    if you want to ignore the namespace you could do

    doc.SelectSingleNode("//*[local-name()='Requestor']")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 3rd party webservice (happens to be a peoplesoft EIP service) that
I have XML that is returned by a 3rd party web service in the
I have a class that unmarshals xml from a 3rd party source (I have
I have an XML document: var xml:XML = new XML(<rootNode> <head> <meta name=template content=Default
I have the following XML document: <projects> <project> <name>Shockwave</name> <language>Ruby</language> <owner>Brian May</owner> <state>New</state> <startDate>31/10/2008
We have a VXML project that a 3rd party parses to provide us with
I am really new to XMl and have been tasked with extracting some values
i am new for XML.i have a function that takes four input.on the basis
I have an xml document that looks something like below (resources.xml), with a corresponding
still new to XML parsing with the iphone so i have a few questions.

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.