Function Syntax: private XmlElement addXmlElement (XmlDocument doc, XmlElement parent, string prefix, string localName, string namespaceURI)
{
XmlElement elem = doc. CreateElement (prefix, localName, namespaceURI );
Parent. AppendChild (elem );
Return elem;
}
Private XmlAttribute addXmlAttribute (XmlDocument doc, XmlElement elem, string name, string val)
{
XmlAttribute attr = doc. CreateAttribute (name );
Attr. Value = val;
Elem. Attributes. Append (attr );
Return attr;
}
Private XmlAttribute addXmlAttribute (XmlDocument doc, XmlElement elem, string name, string val, string prefix, string ns)
{
XmlAttribute attr = doc. CreateAttribute (prefix, name, ns );
Attr. Value = val;
Elem. Attributes. Append (attr );
Return attr;
}
Function usage: XmlDocument doc = null;
XmlElement config = addXmlElement (doc, doc. DocumentElement, "sox", "Config", "Microsoft. Solutions. InformationWorker. Sox ");
XmlElement elem = addXmlElement (doc, config, "sox", "Taxonomy", "Microsoft. Solutions. InformationWorker. Sox ");
AddXmlAttribute (doc, elem, "maxDepth", "8 ");
Usage: <sox: Config>
<Sox: Components maxDepth = "16">
</Sox: Components>