Copy link to clipboard
Copied
Hey guys! I have a valid XML structure, and in it is the following info:
<app>
<settings>
<setting name="defaultModuleSlug" value="apples"></setting>
<setting name="defaultPageSlug" value="oranges"></setting>
</settings>
<app>
The XML info is in an application object called application.config.
So, How do I reference the defaultPageSlug variable? I know I can use:
application.config[ 'app' ][ 'settings' ].xmlChildren[ 2 ].xmlAttribute[ 'value' ]
However, I'd like to be able to reference the setting by it's name attribute (defaultPageSlug) and not assuming it's the 2nd element in that node. Can someone help?
Nevermind, I guess I can just use XPath.
Copy link to clipboard
Copied
Nevermind, I guess I can just use XPath.