RE: XmlDocument xsi: Problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Mark,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to create a root node like
<TestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="TestCaseSchema_03.xsd">. If there is any
misunderstanding, please feel free to let me know.

In this case, we can first create an attribute node using
XmlDocument.CreateAttribute() and then add it to the element using
XmlElement.SetAttributeNode() method. Here I wrote some sample code. HTH.

XmlDocument doc = new XmlDocument();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance";);

XmlElement ele = doc.CreateElement("TestCase");
XmlAttribute att = doc.CreateAttribute("xsi", "noNamespaceSchemaLocation",
"http://www.w3.org/2001/XMLSchema-instance";);
att.Value = "TestCaseSchema_03.xsd";
ele.SetAttributeNode(att);
doc.AppendChild(ele);

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

.



Relevant Pages

  • Re: Value Mapping to Root Node
    ... Larry Franks ... This posting is provided "AS IS" with no warranties,and confers no rights. ... | | Subject: Re: Value Mapping to Root Node ... The destination is an Attunity database interaction schema, ...
    (microsoft.public.biztalk.general)
  • RE: Custom settings in App.config
    ... I would like to confirm my understanding of your issue. ... I understand that you need to read the settings in ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Copy a project
    ... > Hi Dale, ... I would like to confirm my understanding of your issue. ... > rights." ... Prev by Date: ...
    (microsoft.public.vstudio.sourcesafe)
  • RE: question regarding this httpmodule
    ... I would like to confirm my understanding of your issue. ... I understand that you need to implement the IHttpModule ... Prev by Date: ...
    (microsoft.public.dotnet.general)
  • RE: Differences in .Resources files between Visual Studio 2005 beta1 a
    ... I think you may try to post in vs2005 forum. ... Thanks for your understanding! ... This posting is provided "AS IS" with no warranties, and confers no rights. ... Prev by Date: ...
    (microsoft.public.dotnet.framework)