473,385 Members | 2,044 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,385 software developers and data experts.

reading xml "attribute name"

42
hi all..
can any one help me by suggesting an idea to take the attribute "name" from a node.

<r t="error" a="active" i="">
here t , a , i are the attribute name
and
"error" , "active" , "" are the values.

here "r" is the node and t="error" ,a="active" , i="" are the attributes...

here i kno how to get the values of the attributes t,a and i.

but what i need is to read the name of attributes ie t,a and i. can any one suggest.
thanks in advance.
Oct 24 '08 #1
3 2730
markmcgookin
648 Expert 512MB
hi all..
can any one help me by suggesting an idea to take the attribute "name" from a node.

<r t="error" a="active" i="">
here t , a , i are the attribute name
and
"error" , "active" , "" are the values.

here "r" is the node and t="error" ,a="active" , i="" are the attributes...

here i kno how to get the values of the attributes t,a and i.

but what i need is to read the name of attributes ie t,a and i. can any one suggest.
thanks in advance.
Is this in .Net?

Try:

Expand|Select|Wrap|Line Numbers
  1. foreach(XMLAttribute att in r.Attributes)
  2. {
  3.     if (att.Name == "a")
  4.     {
  5.         //do something
  6.     }
  7. }
  8.  
Oct 24 '08 #2
libish
42
Is this in .Net?

Try:

Expand|Select|Wrap|Line Numbers
  1. foreach(XMLAttribute att in r.Attributes)
  2. {
  3.     if (att.Name == "a")
  4.     {
  5.         //do something
  6.     }
  7. }
  8.  

yes this is in c#.net...
what does "r" stands for
i tried XmlTextReader "reader.Attributes" but there is no such option available..
can u please specify little bit more..
Oct 27 '08 #3
markmcgookin
648 Expert 512MB
yes this is in c#.net...
what does "r" stands for
i tried XmlTextReader "reader.Attributes" but there is no such option available..
can u please specify little bit more..
r is the name of the xmlnode, so r.attributes would contain a list of all the attributes associated with that node.

Expand|Select|Wrap|Line Numbers
  1. xmldocument xmldoc = new xmldocument();
  2. xmldoc.load(xmlpath);
  3. xmlnodelist nl = xmldoc.getelementsbytagname("r");
  4.  
or something to that effect should return a list of nodes with the name "r" that you could loop through and process.

Mark
Oct 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yamini | last post by:
Here I am trying to use tag files in JSP2.0 with tomcat 5. test.jsp ------- %@ taglib prefix="test" tagdir="/WEB-INF/tags" %> <html> <head> <title>Untitled Document</title> </head> <body>
6
by: Richard | last post by:
<a href="#" name="sample">link 1</a> <a href="#" name="sample">link 2</a> Would this be invalid use of the name? If I wanted to have a function that would be acted upon by detection of the...
3
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their...
12
by: Stefano | last post by:
Hi all, what is the correct use of the "default" attribute in XML Schema? For example: <xs:element name="myProperty" type="xs:string" default="myDefaultValue"/> What can I do with it? What...
3
by: Carl Lindmark | last post by:
*Cross-posting from microsoft.public.dotnet.languages.csharp, since I believe the question is better suited in this XML group* Hello all, I'm having some problems understanding all the ins and...
0
by: Carl Lindmark | last post by:
Hello all, I'm having some problems understanding all the ins and outs with datasets and datatables (and navigating through the filled datatable)... Just when I thought I had gotten the hang...
6
by: Just Me | last post by:
My Task List contains the following: At least one reference is missing the 'Name' attribute. Any suggestion on how toe find which project is missing it? Solution contains 25 projects. ...
1
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element...
0
by: =?Utf-8?B?QXR1bA==?= | last post by:
When .Net 1.0 webservice (VS2003) generates a wsdl - <wsdl:binding name="TestSoap" type="tns:TestSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/(note:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.