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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:57:11+00:00 2026-05-17T01:57:11+00:00

I have an XML document (an InfoPath form) that looks similar to this: <my:ClientMaintenance

  • 0

I have an XML document (an InfoPath form) that looks similar to this:

<my:ClientMaintenance xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-07-06T07:04:54">
    <my:Payments>
    </my:Payments>
    <my:Payment>
        <my:Amount></my:Amount>
        <!-- Several other nodes -->
    </my:Payment>
</my:ClientMaintenance>

The Payment node is used as a template to add new payments to the Payments node. So whenever the Add Payment button is clicked on the form, I need to:

  1. Take a copy of the Payment node in memory
  2. Update the values
  3. Append it as a child to the Payments node

For some reason at the end of this, I can no longer query any nodes in the my namespace! Here’s the code:

public void btnAddPaymentClicked(object sender, ClickedEventArgs e)
{
    var navigator = e.Source.CreateNavigator();
    var blankPayment = GetBlankPaymentNode(navigator).CreateNavigator();
    // new XmlNamespaceManager(blankPayment.NameTable).HasNamespace("my") == false
    // WHY???
}

private XmlDocument GetBlankPaymentNode(XPathNavigator navigator)
{
    var blankPayment = navigator.SelectSingleNode(FullBlankPaymentXPath, NamespaceManager);
    var blankXml = new XmlDocument();
    blankXml.LoadXml(blankPayment.OuterXml);
    var schema = new XmlSchema();
    schema.Namespaces.Add("my", MyNamespaceUri);  // Set elsewhere and != null
    blankXml.Schemas.Add(schema);
    return blankXml;
}

Why can the namespace no longer be referenced?

  • 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-17T01:57:11+00:00Added an answer on May 17, 2026 at 1:57 am

    You need to explicitly add the prefix to the XmlNamespaceManager:

    XPathNavigator blankPayment = GetBlankPaymentNode(navigator).CreateNavigator();
    XmlNamespaceManager nsmngr = new XmlNamespaceManager(blankPayment.NameTable); 
    nsmngr.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003" + 
         "/myXSD/2009-07-06T07:04:54");
    

    Now you can reference the namespace by the prefix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML document that looks like this: <Data xmlns=http://www.domain.com/schema/data xmlns:dmd=http://www.domain.com/schema/data-metadata > <Something>...</Something>
I have the following XML document <?mso-infoPathSolution name=urn:schemas-microsoft-com:office:infopath:TCM-TCP:-myXSD-2012-02-20T14-33-22 solutionVersion=1.0.0.65 productVersion=14.0.0.0 PIVersion=1.0.0.0 href=https://devcoop.oceanspray.com/sites/TCM2/FormServerTemplates/TCM-TCP.xsn?> <?mso-application progid=InfoPath.Document
I have an xml document that looks something like this: <units> <unit> <year></year> <month></month>
I have an xml document that is structured somewhat like this :- <catalog xmlns=format_old
I have XML document that is like this: <BrowseNodes> <BrowseNode> <BrowseNodeId>4075981</BrowseNodeId> <Name>Nutrition Bars</Name> <Ancestors>
I have xml document like below, <chapter xmlns:xi=http://www.w3.org/2001/XInclude xml:id=chapter1> <title>First chapter</title> <section xml:id=section1> <imageobject>
I have an XML document that I'm trying to search through. The Main structure
I have an XML document that I generate from an Entity Framework object. The
I have an XML document that I load in and try to search with
I have an XML document with a section similar to the following: <release_list> <release>

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.