473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

XmlAttribute, Prefix and LocalName

Hi everibody,

I have a XML document that I load as XmlDocument. I would like to add it a
new tag "mytag" with an attribute "xlink:href".
For this purpose I wrote this code:

Dim myNode as XmlElement

myNode= myXmlDocument..CreateElement("myTag")

attr = myXmlDocument.CreateAttribute("xlink:href")

attr.Value = "value of xlink:href"

myNode.Attributes.Append(attr)

AdifferentNode.AppendChild(myNode)
Unfortunately the resultant tag is:
<myTag href="value of xlink:href"/>
but I would like it will be written:
<myTag xlink:href="value of xlink:href"/>.

If I write <myTag href="value of xlink:href"/> my file will not be valid
for the DTD associated.
How can I print in my XML file the prefix "xlink:"?
thank you everibody in advance.

Fede.


Nov 12 '05 #1
2 1966


Fede wrote:

I have a XML document that I load as XmlDocument. I would like to add it a
new tag "mytag" with an attribute "xlink:href".
For this purpose I wrote this code:

Dim myNode as XmlElement

myNode= myXmlDocument..CreateElement("myTag")

attr = myXmlDocument.CreateAttribute("xlink:href")

You need
CreateAttribute("xlink", "href", "http://www.w3.org/1999/xlink")
check the overloads for CreateAttribute for a documentation.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
You need
CreateAttribute("xlink", "href", "http://www.w3.org/1999/xlink")
check the overloads for CreateAttribute for a documentation.


Thank you!!!
Is exactly what I need.

Fede
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anita C | last post by:
I have the foll. code to update the value of an attribute: xmlDocument.Load("abc.xml"); XmlAttribute xmlAttrib = xmlDocument.SelectSingleNode(root/web/theme/@desc); xmlAttrib.Value =...
1
by: raffelm | last post by:
I have a class with a property is set to export as an XmlAttribute. I want the attribute to only be written if there is a value. Is that possible? Right now, the attribute is written no matter...
1
by: dpakpaul | last post by:
Hi, I have an XSD schema where I have attributes that are declared to contain non string values such as integers etc. Take for example, this declaration - <xs:attribute name="IsThisTrue"...
3
by: Paul | last post by:
Does anyone have an idea how to retrieve all nodes in an XmlDocument where the LocalName is equal to some string?
5
by: Dirk Reske | last post by:
Hello, I've created a collection. public class MyCollection:CollectionBase { public int Version; }
1
by: Marc Gravell | last post by:
Apologies if this is a known issue... I don't know if this is an intentional feature change, or simply a bug... but! I recently upgraded a web service to WSE3, specifically to use MTOM in a...
2
by: james.cssa | last post by:
I want to declare namespace prefix in the Envelope element (i.e. xmlns:xsi and xmlns:xsd) so that the document will be serialized to look like the following. However, I don't know the right way to...
3
by: Roy | last post by:
I have an XmlDocument loaded from an xml file. I have also an xsd schema file associated with it so that it will be in the XmlSchemaSet. How do I get the data type for the value of an XmlElement...
5
by: johanneskrueger | last post by:
Hello, I'm currently using <xsl:copy-of select="document(...)/svg:svg"/to embed an SVG file into an XHTML file. I already defined the SVG namespace and assigned svg as its prefix in my XSLT 1.0...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.