Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Object typedef error

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
GB
Hi all,

Please see the snippet below.

The exception is being thrown. The XML string is dead simple like <xml><tagName value="://?&"></xml>. I use VIM and I can clearly see there is not a typo in variable names. Can you please explain why I am getting the Typedef error?

It is for an Opera Extension for personal use, but I doubt the Typedef error is caused by the browser.

JavaScript:
 var accessing = xml.getElementsByTagName('tagName'); 
    if(accessing) // its definitely valid XML
    {
        try
	{
	   var accessObject = accessing[0];
	   alert(accessObject.getAttribute('value'));  // displays the expected "://?&" string
	   var value = accessObject.getAttribute('value'); [COLOR=#5C3566]// what could possibly go wrong?[/color]
        }
        catch(e)
        {
           alert(e.toString()); [COLOR=#5C3566]// Typedef Error: cannot convert accessObject to Object[/color]
        }
    }

--Glen :)
 
Ah!! It was caused by multiple documents being parsed at the same time, so was actually different XML.

No matter :)

--Glen :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top