MFRASER wrote:
> Ok. I am new to the DOM document idea. I previously just created my XML
> using a textbuilder or string object.
>
> Now I am trying to create the XML in a string format, send the XML to
> another object , and rebuild the DOM inside the object.
>
> Here is my code pay attention to the last five lines.
> //Start building XMLDocument
>
> private string CovertObjectString(MyObject MyObject)
>
> {
>
> System.Xml.XmlDocument XMLDoc = new System.Xml.XmlDocument();
>
> System.Xml.XmlNamespaceManager nsManager = new
> System.Xml.XmlNamespaceManager(XMLDoc.NameTable);
>
>
> nsManager.AddNamespace("dd", "
http://acme.com/Data.xsd");
>
> nsManager.AddNamespace("vi", "
http://acme.com/Value.xsd");
>
> nsManager.AddNamespace("wp", "
http://acme.com/WeeklyData.xsd");
>
> try
>
> {
>
> //get the root information from base
>
> //Get Patthern ID
>
> //Create Values Element
>
> System.Xml.XmlNode XMLValuesNode =
> XMLDoc.CreateElement("wp:Values");
>
>
> //Create Value Element add to values
>
> System.Xml.XmlNode XMLValue = XMLDoc.CreateElement("Value");
>
> .....
>
>
>
> XMLValuesNode.AppendChild(XMLValue);
>
>
>
> //Append Data to XMLDocument
>
> XMLDoc.AppendChild(XMLValuesNode);
>
>
> }
>
> catch{}
>
> //I need to do the following for the wp: to appear this doesn't seem
> right.
>
> System.Text.StringBuilder retVal = new
> System.Text.StringBuilder(XMLTP.OuterXml + XMLDoc.OuterXml.ToString());
>
> retVal.Replace("<Values", "<wp:Values");
>
> retVal.Replace("</Values", "</wp:Values");
>
> return retVal.ToString();
>
> }
appropriate tools like XSLT to do that. Consider looking into XSLT to