Jump to content

getElementsByTagName and a variable


mwl707

Recommended Posts

Hi I want to retrieve XML by using a variable , as an example

 

 

entry = xmlDocument.getElementsByTagName('xml_name');

 

this works fine , But i want to use a variable

 

a = "xml_name" ;

 

entry = xmlDocument.getElementsByTagName(a);

 

I have tried " and ' and + but cannot get the code to recognise the a variable

 

Can anyone tell me where i am going wrong please ???

Link to comment
https://forums.phpfreaks.com/topic/176293-getelementsbytagname-and-a-variable/
Share on other sites

Hi I want to retrieve XML by using a variable , as an example

 

 

entry = xmlDocument.getElementsByTagName('xml_name');

 

this works fine , But i want to use a variable

 

a = "xml_name" ;

 

entry = xmlDocument.getElementsByTagName(a);

 

I have tried " and ' and + but cannot get the code to recognise the a variable

 

Can anyone tell me where i am going wrong please ???

 

Show more code.  It could be a scope issue.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.