mwl707 Posted October 2, 2009 Share Posted October 2, 2009 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 More sharing options...
KevinM1 Posted October 2, 2009 Share Posted October 2, 2009 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. Link to comment https://forums.phpfreaks.com/topic/176293-getelementsbytagname-and-a-variable/#findComment-929111 Share on other sites More sharing options...
ProXy_ Posted October 4, 2009 Share Posted October 4, 2009 You could try this: var a = "xml_name"; entry = xmlDocument.getElementsByTagName(a); Link to comment https://forums.phpfreaks.com/topic/176293-getelementsbytagname-and-a-variable/#findComment-929970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.