469,328 Members | 1,324 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

XmlDocument.DocumentElement is null?

The DocumentElement is always null? and is readonly?

How to I add node items to the root?

I'm try to create a document from nothing.
All the samples start by loading a string or file.

Thanks,

Schneider
Nov 12 '05 #1
3 13150
The XML version of Hello World!
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateProcessingInstruction("x ml", "version=\"1.0\"
encoding=\"UTF-8\""));
XmlElement root = doc.CreateElement("root");
doc.AppendChild(root);
root.InnerText = "Hello world!";
Console.WriteLine(doc.OuterXml);
Console.Read();
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"schneider" <00**@0000.SPAM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
The DocumentElement is always null? and is readonly?

How to I add node items to the root?

I'm try to create a document from nothing.
All the samples start by loading a string or file.

Thanks,

Schneider

Nov 12 '05 #2
Thanks,

Never created a doc via code and Xml object model before...

I think I need a good ref book? VB?

From Xsl,Xml,Paths,... there seems to be a lot of functionality.

Schneider
"Dennis Myrén" <de****@oslokb.no> wrote in message
news:Ae****************@news2.e.nsc.no...
The XML version of Hello World!
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateProcessingInstruction("x ml", "version=\"1.0\"
encoding=\"UTF-8\""));
XmlElement root = doc.CreateElement("root");
doc.AppendChild(root);
root.InnerText = "Hello world!";
Console.WriteLine(doc.OuterXml);
Console.Read();
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"schneider" <00**@0000.SPAM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
The DocumentElement is always null? and is readonly?

How to I add node items to the root?

I'm try to create a document from nothing.
All the samples start by loading a string or file.

Thanks,

Schneider


Nov 12 '05 #3
Just continue laborating with the XML DOM and you will be up and running in
a short time.

The best book IMO is google, if you get stuck try a google search on the
keywords of your problem(like "C# XML SelectSingleNode"), and you are very
likely to find something useful on the topic.
There are also a number of sites on the net dedicated to XML.
www.xmlforasp.net
is just one of them.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"schneider" <00**@0000.SPAM> wrote in message
news:ux**************@TK2MSFTNGP15.phx.gbl...
Thanks,

Never created a doc via code and Xml object model before...

I think I need a good ref book? VB?

From Xsl,Xml,Paths,... there seems to be a lot of functionality.

Schneider
"Dennis Myrén" <de****@oslokb.no> wrote in message
news:Ae****************@news2.e.nsc.no...
The XML version of Hello World!
XmlDocument doc = new XmlDocument();
doc.AppendChild(doc.CreateProcessingInstruction("x ml",
"version=\"1.0\"
encoding=\"UTF-8\""));
XmlElement root = doc.CreateElement("root");
doc.AppendChild(root);
root.InnerText = "Hello world!";
Console.WriteLine(doc.OuterXml);
Console.Read();
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"schneider" <00**@0000.SPAM> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
> The DocumentElement is always null? and is readonly?
>
> How to I add node items to the root?
>
> I'm try to create a document from nothing.
> All the samples start by loading a string or file.
>
> Thanks,
>
> Schneider
>
>



Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Yechezkal Gutfreund | last post: by
3 posts views Thread by TnaG | last post: by
4 posts views Thread by aaa | last post: by
3 posts views Thread by Mungo Jerrie | last post: by
1 post views Thread by David Dvali | last post: by
reply views Thread by Mae Lim | last post: by
5 posts views Thread by Gustaf | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.