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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:15:49+00:00 2026-06-11T11:15:49+00:00

This is my two xml document. This xml is stored in paraouterXml string. <w:tbl>

  • 0

This is my two xml document.

This xml is stored in paraouterXml string.

<w:tbl>
 <w:tblPr>
 </w:tblPr>
 <w:tblGrid>
 </w:tblGrid>
</w:tbl>

This xml is stored in tblMetaInfo string.

<root>
 <w:tblPr>
  <w:tblStyle w:val="TableGrid" /> 
  <w:tblW w:w="0" w:type="auto" /> 
  <w:tblLook w:val="04A0" /> 
  </w:tblPr>
 <w:tblGrid>
  <w:gridCol w:w="1947" /> 
  <w:gridCol w:w="1947" /> 
  </w:tblGrid>
</root>

So,here i want to replace paraouterXml’s <w:tblPr>,<w:tblGrid> with tblMetaInfo’s <w:tblPr>,<w:tblGrid> elements.

This is c# code…

XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(table.OuterXml);
XmlNode newNode = xDoc.DocumentElement;

XmlNodeList tblPrNode = xDoc.GetElementsByTagName("w:tblPr");
tblPrNode[0].RemoveAll();
XmlNodeList tblGridNode = xDoc.GetElementsByTagName("w:tblGrid");
tblGridNode[0].RemoveAll();

XmlDocument xDoc1 = new XmlDocument();
xDoc1.LoadXml(tblMetaInfo);
XmlNode newNode1 = xDoc1.DocumentElement;
XmlNodeList tblPrNode1 = xDoc1.GetElementsByTagName("w:tblPr");
XmlNodeList tblGridNode1 = xDoc1.GetElementsByTagName("w:tblGrid");

tblPrNode[0].ReplaceChild(tblPrNode1[0], tblPrNode[0]);
tblGridNode[0].ReplaceChild(tblGridNode1[0], tblGridNode[0]);

But it throwing some error…

Please guide me to get out of this issue…

  • 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-11T11:15:50+00:00Added an answer on June 11, 2026 at 11:15 am

    ArgumentException: The newChild was created from a different document than the one that created this node.

    public XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild):

    If the newChild was created from another document, you can use XmlDocument.ImportNode to import the node to the current document. The imported node can then be passed to the ReplaceChild method.

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

Sidebar

Related Questions

this is my situation: I have two org.w3c.dom.Document created from two xml files. What
could anyone assist me with this. I need to compare two beefy xml files
In this the catalog.xml file. I have two books who have the same inventory
I've tried this two ways. Way 1 function Login() { var email = encodeURIComponent($(#loginemail).val());
I have GPS data stored as as .tcx file. This is a xml file
We're parsing an XML document using JAXB and get this error: [org.xml.sax.SAXParseException: Invalid byte
I've been trying to combine two XML documents like this: $def = new DOMDocument(
I have a variable that contains a long string that represents an XML document.
This is the stored procedure I'm using to get 5 digits from an xml:
I'm getting two different hashes of the same xml document when I directly canonicalize

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.