473,396 Members | 1,758 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,396 software developers and data experts.

How I can get the element name.

Hi ALL,

Can anyone suggest me how I can get the element name by knowing its attribute value.

For eg:

<Channel>
<US>
<C100345>
<Article id="345">
<Hello>
</Article>
</C100345>
</US>
</Channel>

Here I know the attribute id=345 so how I can get its element name?
If suppose we don't know the attribute value also but we know after channel the element name is US so in this case how I can get its next sibling element name?

Regards,
Arun.
Mar 12 '08 #1
8 2574
jkmyoung
2,057 Expert 2GB
What language are you using? in javascript:
getElementById("345").nodeName

--
xpath
Channel/US/ something....
What sibling are you referring to, sibling of Channel, US, or Article?
Mar 12 '08 #2
What language are you using? in javascript:
getElementById("345").nodeName

--
xpath
Channel/US/ something....
What sibling are you referring to, sibling of Channel, US, or Article?
Hi,

I need to get the element name after <C100345>, that is <Article>
Here is mentioned element name as Article it can be magazine and article so i need to know weather its magazine or article which is coming from xml.
I read in one of the post the use of local-name(). How can i do in this?
Mar 12 '08 #3
jkmyoung
2,057 Expert 2GB
xpath?

local-name(following::*[1])
Mar 12 '08 #4
xpath?

local-name(following:*[1])
Yeah i mean to say xpath.

Using xslt i have to get that element name from xml file.

What expression i need to write?
Mar 12 '08 #5
jkmyoung
2,057 Expert 2GB
<xsl:value-of select="local-name(following::*[1])"/>
Mar 12 '08 #6
<xsl:value-of select="local-name(following::*[1])"/>
Hi,

I tried but it is not working it seems.

Actually i hav a presentation template which will generate the page in html. This file is of .xml extension.In this template i have given:
<h1>
<time:type />
<h1>

Then there is a xslt file in which i wrote the code for <time:type />. It is like:
<xsl:template match="time:type" mode="base">
<xsl:param name="param.context" tunnel="yes" as="*" />
<xsl:value-of select = "$param.context/name()" />
<xsl:value-of select = "$param.context/local-name()" />
<xsl:value-of select = "$param.context/namespace-uri()" />
</xsl:template>

I even tried local-name(following::*[1]) but both of the expression is not working.
Pl give some suggestion.
Thanks.
Mar 12 '08 #7
jkmyoung
2,057 Expert 2GB
Is your template in the xslt, or is it in another xml file altogether?

Trying to figure out how you're linking this thing.
Mar 13 '08 #8
Hai this is javascript code for hove to get the id value


syntax:-

var somename=document.getElimentById("Id Name ").value;



Example :-

var reddy=document.getElimentById("345 ").value;

or

var reddy=document.form1.345.value;
Mar 13 '08 #9

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

Similar topics

4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
6
by: Wole Ogunremi | last post by:
I guess this is a well asked question but it is tripping me up! I'm putting a forum together allowing xhtml markup content. I am validating against a schema but getting "Could not find schema...
1
by: unwiseone | last post by:
Hello, Does any know how to specify a value of a DTD element? For example, here's an external DTD that I have: ======================================= <!ELEMENT summercamps (Camp+)>...
1
by: jrmsmo | last post by:
Hi there, I have an interesting problem that maybe you pros can suggest how I solve. I'm working with a third party program that serializes an XML document (it was obviously not designed with schema...
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...
3
by: myghty | last post by:
Hi! I am writing an xml schema and i came to an problem. I want to have element "protocol" 2 times but each time with different properties. It also has an element access also each time different...
3
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
3
markmcgookin
by: markmcgookin | last post by:
Hi, I have the following XML <AnswerList xmlns="http://tempuri.org/ALPS_Assessmentv1p1_RESCO_Schema.xsd"> <DateTimeLastSaved>12:12:12 1900</DateTimeLastSaved> <UserName>Bob</UserName>...
2
by: mlb5000 | last post by:
I seem to be having issues validating an XML document using my schema. Both are below: The Schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema...
0
by: icesign | last post by:
I know that the selector of these elements has a scope relative to the element being declared, but maybe there is a way to get beyond bounds of this scope or maybe just a way to extend base element?...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.