473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple IE xpath help

I know how to edit my page using xpath selectors in firefox, it's just
like this (in the else if). However, I can't find any way to do it in
IE? I just want to find all links with the className=='lef tNavPElement'
and then set them to 'leftNavBltItem ', but I can't find how to do the
xpath stuff in IE. Can somebody please fill in the if statment ie code
for me?

if (window.ActiveX Object)
{

//how do I do the code below for IE???
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.imple mentation &&
document.implem entation.create Document)
{
try
{
var layers =
document.evalua te('//a[@class="leftNav PElement"]', document, null,
XPathResult.ANY _TYPE, null );

var thisLayer = layers.iterateN ext();
while (thisLayer) {

thisLayer.class Name="leftNavBl tItem";
thisLayer = layers.iterateN ext();
}

}
catch(exception )
{
//this try catch is required for the
leftnav to work for some reason....
}
}
else
{
alert('errors in breadcrums.js line: 104');
}

Jan 23 '07 #1
2 4188
eg****@gmail.co m wrote:
I know how to edit my page using xpath selectors in firefox, it's just
like this (in the else if). However, I can't find any way to do it in
IE? I just want to find all links with the className=='lef tNavPElement'
and then set them to 'leftNavBltItem ', but I can't find how to do the
xpath stuff in IE.
Mozilla and Opera 9 support XPath over HTML DOM documents, IE does not
do that. If you want to find all a elements with a certain className
value then loop over document.getEle mentsByTagName( 'a') and check the
className property in the loop.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 23 '07 #2
Thanks, don't know why I couldn't find that documented anywhere....

On Jan 23, 5:10 am, Martin Honnen <mahotr...@yaho o.dewrote:
egg...@gmail.co m wrote:
I know how to edit my page using xpath selectors in firefox, it's just
like this (in the else if). However, I can't find any way to do it in
IE? I just want to find all links with the className=='lef tNavPElement'
and then set them to 'leftNavBltItem ', but I can't find how to do the
xpath stuff in IE.Mozilla and Opera 9 support XPath over HTML DOM documents, IE does not
do that. If you want to find all a elements with a certain className
value then loop over document.getEle mentsByTagName( 'a') and check the
className property in the loop.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 25 '07 #3

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

Similar topics

1
2589
by: Joshua Beall | last post by:
Hi All, I have a task that should be very simple but I'm running into trouble. All I want to do is query a document using XPath, and save the resulting XML in a string. Here's that I am trying (PHP5): // $xml has the entire XML document in it; I included it for reference at the end of the document $dom = new DOMDocument(); $dom->loadXML($xml);
0
1929
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
2794
by: Kirk | last post by:
I am trying to use a simple xpath expression, the code looks like this: Dim xdoc As New System.Xml.XmlDocument Dim xnode1 As System.Xml.XmlNode Dim xlist As System.Xml.XmlNodeList xdoc.LoadXml(Application("MenuXML")) xlist = xdoc.DocumentElement.SelectNodes("//MenuItem")
7
20400
by: chris.millar | last post by:
The below xml is saved as a file, i want the quickest way in c# of reading just the DataSource section and returning it as a string, can anyone help me out. Cheers Chris. <NewDataSet> <DataSource> <name>Oracle</name> <IsMaster>0</IsMaster>
7
5495
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned that an xpath expression can be bounded by either single or double quotation marks. But sometimes I want to search for a title containing both a single and double quote. Any way to do this?
2
5623
by: Locusta | last post by:
Hello, I would like to use XPATH in a C program to retrieve values from XML documents. Did anyone tried this and can give me some advice? Cheers, Locusta
6
6827
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add /document/node=\<hello\ < in.xml out.xml so, it would simple add/remove/change commands (either as arguments or input script file), a bit of xpath and the usual Unix parameters (-o output,-f
3
4980
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml version="1.0" encoding="utf-8" ?> <thing xmlns="urn:thing-schema-v1"> <foo>foo thing</foo> <bar>bar thing</bar>
2
1792
by: Monty | last post by:
Despite reading posts in Google, I don't understand XPATH. Can someone help me write an XPATH. From Google I think my problem is that the default namespace does not have a prefix. I can't change this as I have received this XML and I didn't create it. All I want to is retrieve the PROJECTNAME from the following XML. I am typing this XML and XPATH into this site http://www.activsoftware.com/xml/xpath/ The XPATH that does not work is...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.