|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Not being tricky with XmlDocumentfly", I mean, build it in memory so as to extract its contents with the property "OuterXml". I know how to create elements and attributes inside these elements, and text and more elements inside elements... ¡except the first element! (the DocumentElement). How can I create it? Because I think I am now using a very "tricky" method...: using System.Xml; (...) XmlDocument miNuevoDocumentoXml = New XmlDocument(); miNuevoDocumentoXml.LoadXml("<ROOT />"); (...) Is there any other way to create the primary element called ROOT? Thanks in advance. Regards, Andrew
Show quote
Hide quote
"knocte" <knocte@NO-SPAM-PLEASE-gmail.com> wrote in message Trynews:d2prlu$2hr$1@nsnmpen3-gest.nuria.telefonica-data.net... >I am using the XmlDocument class to generate a XML document "on the fly", I >mean, build it in memory so as to extract its contents with the property >"OuterXml". > > I know how to create elements and attributes inside these elements, and > text and more elements inside elements... ¡except the first element! (the > DocumentElement). How can I create it? Because I think I am now using a > very "tricky" method...: > > using System.Xml; > > (...) > > XmlDocument miNuevoDocumentoXml = New XmlDocument(); > miNuevoDocumentoXml.LoadXml("<ROOT />"); miNuevoDocumentoXml .DocumentElement = miNuevoDocumentoXml .CreateElement("ROOT"); Mike Schilling escribió:
Show quoteHide quote > "knocte" <knocte@NO-SPAM-PLEASE-gmail.com> wrote in message Thanks for your answer, Mike, but that property is read-only.> news:d2prlu$2hr$1@nsnmpen3-gest.nuria.telefonica-data.net... > >>I am using the XmlDocument class to generate a XML document "on the fly", I >>mean, build it in memory so as to extract its contents with the property >>"OuterXml". >> >>I know how to create elements and attributes inside these elements, and >>text and more elements inside elements... ¡except the first element! (the >>DocumentElement). How can I create it? Because I think I am now using a >>very "tricky" method...: >> >>using System.Xml; >> >>(...) >> >>XmlDocument miNuevoDocumentoXml = New XmlDocument(); >>miNuevoDocumentoXml.LoadXml("<ROOT />"); > > > Try > miNuevoDocumentoXml .DocumentElement = > miNuevoDocumentoXml .CreateElement("ROOT"); > > Anyone knows another method? Regards, knocte
Show quote
Hide quote
"knocte" <knocte@NO-SPAM-PLEASE-gmail.com> wrote in message So it is..news:d31lcc$rsg$1@nsnmpen3-gest.nuria.telefonica-data.net... > Mike Schilling escribió: >> "knocte" <knocte@NO-SPAM-PLEASE-gmail.com> wrote in message >> news:d2prlu$2hr$1@nsnmpen3-gest.nuria.telefonica-data.net... >> >>>I am using the XmlDocument class to generate a XML document "on the fly", >>>I mean, build it in memory so as to extract its contents with the >>>property "OuterXml". >>> >>>I know how to create elements and attributes inside these elements, and >>>text and more elements inside elements... ¡except the first element! (the >>>DocumentElement). How can I create it? Because I think I am now using a >>>very "tricky" method...: >>> >>>using System.Xml; >>> >>>(...) >>> >>>XmlDocument miNuevoDocumentoXml = New XmlDocument(); >>>miNuevoDocumentoXml.LoadXml("<ROOT />"); >> >> >> Try >> miNuevoDocumentoXml .DocumentElement = >> miNuevoDocumentoXml .CreateElement("ROOT"); >> >> > > > Thanks for your answer, Mike, but that property is read-only. In that case, just do miNuevoDocumentoXml .AppendChild(miNuevoDocumentoXml ..CreateElement("ROOT"));
Other interesting topics
|
|||||||||||||||||||||||