create xmlelement without xmldocument

HI!
how to create xmlelement without xmldocument?
thanks
[72 byte] By [chorweng] at [2008-2-8]
# 1

XmlDocument contains all the data. XmlElement is only way to access these data.

Create XmlDocument and then create XmlElement. If you want to bring this element content to another document you may use ImportNode.

TheXMLMan at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 2
You cannot create an XmlElement without an XmlDocument. XmlDocument establishes the document context, like namespaces and XmlNameTables for all the elements in that document and every XmlNode has an OwnerDocument property. The XmlNameTable provides an important optimization for XmlElements, because it stores one string for each unique element name. So when you have a document with thousands of elements with the same name, there is only one string object for that name shared by all those elements. If we made it possible to have XmlElements live outside of XmlDocuments you would lose these important optimizations, or you would have to make the XmlNameTable global to the process, which then creates contention issues in multithreaded environments like ASP.NET. So there has been a lot of thought gone into this design. If you just need a light weight bad of named values with no XmlDocument overhead, perhaps XmlElement is not the best choice. If you have to use XML data model then perhaps you can find a place to put the XmlDocument that makes sense as a factory for all you XmlElements. From time to time you might recycle this XmlDocument object to free up unused names in the XmlNameTable and start over.
ChrisLovett at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified