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

xpath syntax?

<xml>
<key name="Tokens\Encotone=4086" friendlyName="Encotone">
<param name="A_1" />
<param name="B_2" />
<param name="C_3" />
</key>

<key name="Tokens\Encotone=4087" friendlyName="Encotone">
<param name="A_4" />
<param name="B_5" />
<param name="C_6" />
</key>
</xml>

I'm trying to find the xpath syntax for the "param" with a name of
"B_5".
Can someone tell me if the entry below is correct?

"xml/key/@friendlyName=Econotone/attribute/@name=B_5"

Also I'm looking for a way to replace that entire element once i'm able
to select it with xpath, but haven't found a good way to do that yet.
Any suggestions woudl be appreciated.

-Inet

Apr 25 '06 #1
4 1456
"/xml/key[@friendlyName="Econotone"]/param[@name=B_5]"

If you don't understand why, start by reading a good xpath tutorial.
Also I'm looking for a way to replace that entire element once i'm able
to select it with xpath, but haven't found a good way to do that yet.
Any suggestions woudl be appreciated.


XPath per se has no replacement mechanism. If you're using the DOM Level
3 XPath API to evaluate this path, you can alter the returned node using
DOM methods on that node. If you're using XSLT, you'd output the
replacement rather than outputting the node itself. Again, see tutorials
on those tools for more info.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Apr 25 '06 #2
Joseph Kesselman wrote:
"/xml/key[@friendlyName="Econotone"]/param[@name=B_5]"


Whups. Typos in the quoting of values; sloppy of me.
"/xml/key[@friendlyName='Econotone']/param[@name='B_5']"

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Apr 25 '06 #3

Joseph Kesselman wrote:
Whups. Typos in the quoting of values;


There's also a typo by the OP for "Econotone" vs. "Encotone"
Sometimes the simple stuff like this can confuse the hell out of you -
you think it's some subtle XPath problem when really it's just a
trivial string typo.

Apr 26 '06 #4
Andy Dingley <di*****@codesmiths.com> wrote:
There's also a typo by the OP for "Econotone" vs. "Encotone"


Good catch. Don't assume posted code has been tested... <smile/>
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 26 '06 #5

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

Similar topics

0
by: gael.pegliasco | last post by:
Hi, How are you dear and nice helper :) ? I'm trying to test xpath with this simple program : import xml.dom.minidom from xml.xpath.Context import Context import xml.xpath
2
by: GIMME | last post by:
For starters .... If : //input is the xpath syntax to see if an element with an attribute named start_date exists ... Then what is the xpath syntax to return elements having
3
by: Kathy Burke | last post by:
Hi again, I'm using the following xpath (works in visualizer) with a SelectSingleNode("xpath") statement. //Station/(WI])]/@order Problem is I get an error "expression passed to this method...
1
by: Brad Hehe | last post by:
I am attempting to use XPath to query for a specific node in the sample XML I've provided below. I'm unsure of the exact XPath syntax, but I believe I need the following query to get the proper...
0
by: Franck | last post by:
Hi, Tryin to fill range with xml data like this in my Excel Addin '1. Add Schema oExcel.ActiveWorkbook.XmlMaps.Add(tmpDs.GetXmlSchema, oRootElement) '2. Map fields...
9
by: David Thielen | last post by:
Hi; I am sure I am missing something here but I cannot figure it out. Below I have a program and I cannot figure out why the xpath selects that throw an exception fail. From what I know they...
6
by: Gale | last post by:
I'm working on something in jQuery with XPath What I want to do is: if checkbox is checked, set background color od label that contain input(checkbox) to red I have this code:...
2
by: redcic | last post by:
Hi all, I would like to build a xml file using Xerces. I know how to build a single node at a time. For example, with 'doc' belonging to the DocumentImpl class and with 'docRootNode' belonging...
2
by: arunairs | last post by:
Hi, Is there a way of validating and XPath? In this case , I am accepting an XPath from the user and I need to validate the XPath syntax. Is there a regular expression available that anyone can...
14
by: Mikhail Teterin | last post by:
Hello! What's would be the syntax for a query, which would allow me to get only the elements with non-empty text-nodes? For example, from: <a><b></b></a> <c/> <d><e>meow</e></d>
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: 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: 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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.