RE: XmlDocument xsi: Problem
- From: v-kevy@xxxxxxxxxxxxxxxxxxxx (Kevin Yu [MSFT])
- Date: Thu, 21 Jul 2005 06:00:09 GMT
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."
.
- Follow-Ups:
- Re: XmlDocument xsi: Problem
- From: Mark Jerde
- Re: XmlDocument xsi: Problem
- Prev by Date: Re: Select Nodes
- Next by Date: RE: Optimizing size of generated XML
- Previous by thread: XML and XSD help
- Next by thread: Re: XmlDocument xsi: Problem
- Index(es):
Relevant Pages
|