M
Mazen IIXIS
Guest
Hello all. I'm running into a problem that I can't seem to be able to resolve. The "xsi" kept disappearing from the node that is supposed to show "xsi:type".
XmlDocument xml = new XmlDocument();
XmlDeclaration XmlDeclaration = xml.CreateXmlDeclaration("1.0", null, null);
XmlElement element = xml.CreateElement("Definitions");
XmlNode objectName = xml.CreateElement("AnObject");
element.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
element.SetAttribute("xmlns:xsd", "XML Schema");
xml.AppendChild(XmlDeclaration);
xml.AppendChild(element);
element.Appendchild(AnObject);
XmlElement anObjectElement = xml.CreateElement("ObjectChild");
anObjectElement.SetAttribute("xsi:type","AnObject_Definition");
xml.DocumentElement.ChildNode[0].AppendChild(anObjectElement);
xml.Save("SomeFileNameHere");
I've looked at other forums but they don't seem to provide the right answers that I need to resolve the problem. The attribute have to show <ObjectChild xsi:type="AnObject_Definition">, I kept getting <ObjectChild type="AnObject_Definition">. I need the xsi to be included inside the xml file.
Help will be greatly appreciated!
EDIT: That xsi is absolutely critical to what I am doing. I must have the xsi included at the start. It must be xsi:type or it will throw an critical error in a program that I am working with.
Continue reading...
XmlDocument xml = new XmlDocument();
XmlDeclaration XmlDeclaration = xml.CreateXmlDeclaration("1.0", null, null);
XmlElement element = xml.CreateElement("Definitions");
XmlNode objectName = xml.CreateElement("AnObject");
element.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
element.SetAttribute("xmlns:xsd", "XML Schema");
xml.AppendChild(XmlDeclaration);
xml.AppendChild(element);
element.Appendchild(AnObject);
XmlElement anObjectElement = xml.CreateElement("ObjectChild");
anObjectElement.SetAttribute("xsi:type","AnObject_Definition");
xml.DocumentElement.ChildNode[0].AppendChild(anObjectElement);
xml.Save("SomeFileNameHere");
I've looked at other forums but they don't seem to provide the right answers that I need to resolve the problem. The attribute have to show <ObjectChild xsi:type="AnObject_Definition">, I kept getting <ObjectChild type="AnObject_Definition">. I need the xsi to be included inside the xml file.
Help will be greatly appreciated!
EDIT: That xsi is absolutely critical to what I am doing. I must have the xsi included at the start. It must be xsi:type or it will throw an critical error in a program that I am working with.
Continue reading...