Topic awaiting preservation: XML attribute issue |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: San Antonio |
posted 04-19-2006 17:42
I'm not sure if this is an XML problem I have or C# or what, so if any MadSci feels like moving it, go ahead. code: XmlDocument xd = new XmlDocument(); XmlElement xe1 = xd.CreateElement("someXmlDoc"); xe1.SetAttribute("xsi:noNamespaceSchemaLocation", "C:\\schemas\\someXmlDoc.xsd"); xe1.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); xd.AppendChild(xe1); string text = xd.DocumentElement.OuterXml;
code: "<someXmlDoc noNamespaceSchemaLocation="C:\schemas\someXmlDoc.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />"
|
Paranoid (IV) Inmate From: Cold Sweden |
posted 04-19-2006 21:25
Checking the documentation, you can set the namespace by using three parameters: code: public virtual string SetAttribute ( string localName, string namespaceURI, string value )
code: xe1.SetAttribute("noNamespaceSchemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "C:\\schemas\\someXmlDoc.xsd");
|
Paranoid (IV) Inmate From: San Antonio |
posted 04-20-2006 00:28
I only had time right now to plug that in and try it, but it gives text a value of: code: "<someXmlDoc d1p1:noNamespaceSchemaLocation=\"C:\\schemas\\someXmlDoc.xsd\" xmlns:d1p1=\"http://www.w3.org/2001/XMLSchema-instance\" />"
|