0

I'm trying to add this XML element:

<cp:prop name="given_name" value="UK" />

It has to be formatted exactly as above.

I've tried this but it formats differently:

Dim cp = XNamespace.Get("cp")
Dim newElement As New XElement(cp + "prop", New XAttribute("name", "given_name"), New XAttribute("value", givenName)))

It formats like this:

<prop name="given_name" value="UK" xmlns="cp" />

Please help!! :)

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Oxiegen
0

Do this instead:

Dim newElement As New XElement("cp:prop", New XAttribute("name", "given_name"), New XAttribute("value", givenName)))
0

Tried that, you get this error:

'The ':' character, hexadecimal value 0x3A, cannot be included in a name.'

This damn XML stuff is going to kill me :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.