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 ??? Quote 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. Quote 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); Quote Link to comment https://forums.phpfreaks.com/topic/176293-getelementsbytagname-and-a-variable/#findComment-929970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.