By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

Problem inserting a node with a namespace

P: n/a
This is so silly I must be doing something wrong! I need to insert (using
VB.NET) a new node in a DOM; node has a namespace. I first create, under
programme, basic structure, starting thus:

<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/"
xmlns:pcv="http://prismstandard.org/namespaces/1.2/pcv/">

Then I attempt to add a node with rdf namespace prefix. My call in
skeleton is:

CreateElement("rdf", "subject", nothing)
etc

I add text ("abc") to this element, then add the node as child to root
etc, then later output to file with StreamWriter. The new node ends up as
follows; i.e. without the prefix! I have tried several variations of
above. Any ideas please?

....
<subject>abc</subject>
....

Best Regards, John Walton
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
jw*****@cix.compulink.co.uk wrote:
This is so silly I must be doing something wrong! I need to insert (using
VB.NET) a new node in a DOM; node has a namespace. I first create, under
programme, basic structure, starting thus:

<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:prism="http://prismstandard.org/namespaces/1.2/basic/"
xmlns:pcv="http://prismstandard.org/namespaces/1.2/pcv/">

Then I attempt to add a node with rdf namespace prefix. My call in
skeleton is:

CreateElement("rdf", "subject", nothing)


Try instead

CreateElement("rdf", "subject",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#")

--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #2

P: n/a
In article <#l**************@TK2MSFTNGP10.phx.gbl>, oleg@NO!SPAM!
PLEASEtkachenko.com (Oleg Tkachenko) wrote:
"http://www.w3.org/1999/02/22-rdf-syntax-ns


Thanks that worked!

Although why it should be necessary is totally beyond my comprehension. It
makes the coding very verbose and inefficient, having to pass long uris
around.

Best Regards, John Walton
Nov 12 '05 #3

P: n/a
jw*****@cix.compulink.co.uk wrote:
Although why it should be necessary is totally beyond my comprehension. It
makes the coding very verbose and inefficient, having to pass long uris
around.

Save namespace into a variable :)
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.