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

Problems getting attribute xlink:href in Safari browser

I have managed to get the xml to load using the xmlHTTPrequest...
(inspite of premature readyState 4) the problem now arises
in Safari alone...

var thelink = node.getAttribute("xlink:href")

Works in other browsers... except Safari, where
it always returns null

Any ideas?
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 5 '05 #1
4 3977


Lance Dyas wrote:

var thelink = node.getAttribute("xlink:href")


Assuming the prefix xlink is bound to the namespace URI
http://www.w3.org/1999/xlink you could try

var theLink;
if (typeof node.getAttributeNS != 'undefined') {
theLink = node.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
}
else {
theLink = node.getAttribute('xlink:href');
}

I don't have time to test that now with a Safari browser but if you are
scripting XML with namespace then the namespace relevant methods of DOM
Level 2 like getAttributeNS or getElementsByTagNameNS should be used if
supported by the implementation.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 5 '05 #2
Thanks for the response... my exposure to SVG and scripting within
its various implementations had me trying almost exactly that as of a
month ago there was no joy in Safari (or any other browser for the name
space method), but since there have been a few Safari patches
since then, I might give it another go.

Martin Honnen wrote:


Lance Dyas wrote:

var thelink = node.getAttribute("xlink:href")


Assuming the prefix xlink is bound to the namespace URI
http://www.w3.org/1999/xlink you could try

var theLink;
if (typeof node.getAttributeNS != 'undefined') {
theLink = node.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
}
else {
theLink = node.getAttribute('xlink:href');
}

I don't have time to test that now with a Safari browser but if you are
scripting XML with namespace then the namespace relevant methods of DOM
Level 2 like getAttributeNS or getElementsByTagNameNS should be used if
supported by the implementation.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 5 '05 #3
Just wanted to mention this worked quite nicely, it is a good sign when
browsers do start paying attention to standards!

Martin Honnen wrote:


Lance Dyas wrote:

var thelink = node.getAttribute("xlink:href")


Assuming the prefix xlink is bound to the namespace URI
http://www.w3.org/1999/xlink you could try

var theLink;
if (typeof node.getAttributeNS != 'undefined') {
theLink = node.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
}
else {
theLink = node.getAttribute('xlink:href');
}

I don't have time to test that now with a Safari browser but if you are
scripting XML with namespace then the namespace relevant methods of DOM
Level 2 like getAttributeNS or getElementsByTagNameNS should be used if
supported by the implementation.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 6 '05 #4
Lance Dyas said the following on 10/5/2005 8:15 PM:
Just wanted to mention this worked quite nicely, it is a good sign when
browsers do start paying attention to standards!


Now, if we can just get posters to read and adhere to desired practices
as explained in the groups FAQ. See signature below.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Oct 6 '05 #5

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

Similar topics

1
by: Bernd Oninger | last post by:
As far as I know one could use other xsd schemas with the import and the xlink feature. What are the differences (beside the syntax)? Bernd
1
by: 3W | last post by:
How does one get the browser's width using standards compliant Javascript 1.5/ECMAScript?
7
by: Weston C | last post by:
I'm trying to get the href attribute from the base tag in the document head. The following does not seem to work... any ideas what I'm doing wrong? if(!(document.getElementsByTagName) ||...
3
by: Kevin Matthews | last post by:
i'm having strange problems with browser compatibility between firefox and internet explorer, ---------------------------------------- The following is the CSS:...
2
by: Prasad Dannani | last post by:
Hi, I want to know the browser settings like Image Enabled, Cookie Enabled etc., For Cookies and Script Request object has some properties but after disabling certain features also we are...
2
by: adMjb | last post by:
Hi Any help would be fantastic I have a simple problem but I cant work it out... DOHH...., this is my XML: <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/css"...
4
by: jvanulden | last post by:
Hello all, I am having difficulty figuring out how to create an XmlElement and giving it an attribute that requires a namespace. Here is what I have so far which throws an exception because you...
1
by: kaye80 | last post by:
I have an XML and XSL document. I am trying to incorporate hyperlinks throughout the XML document. I have read many of the related posts on this and other forums but I can't seem to get it right. ...
6
by: paulsparrow | last post by:
Loaded Apache and PHP on a Windows XP box. Apache is working fine. However when I load a .php page I get a "Forbidden Warning You don't have permission to access...
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
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: 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...

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.