Hello

I am trying to pull a variable from a section that is in parent of the Context area. First of all, is this possible? And am I just not doing this right?

To start, my source data is from http://dd.weatheroffice.gc.ca/citypage_weather/xml/QC/s0000769_e.xml

the context is /siteData/warnings/event

and what I want to include is /siteData/warnings@url

Am I using the right syntax?

Any advice would be greatly appreciated. :)

Comments

rbrownell’s picture

The error I am getting is:

warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: Invalid expression in /srv/www/html/sites/all/modules/feeds_xpathparser/FeedsXPathParserHTML.inc on line 85.

rbrownell’s picture

Title: Grab value from different section of XML. » Grab value from outside the context section of XML

Changing title... hoping to make it more attractive.

rbrownell’s picture

Title: Grab value from outside the context section of XML » Grab value from outside the context section of XML... At all possible?
twistor’s picture

Currently I don't think this is supported. I am curious though as to how it could be. Sorry for the delay in responding. The example link you gave me seems to have an empty warnings tag and no events so it's difficult for me to tell.

rbrownell’s picture

No worries, thanks for actually responding though! :)

Sorry the lack of data. At the time, it had tags in the warning area... (It is a weather XML feed so warnings aren't going to exist all the time.) It isn't a total big deal to me to have it working that way because what I am trying to pull has a URL that I think is consistant no matter when the warning is issued but I could be wrong... I tried setting the context to the parent of the children I was trying to capture, but it would then only result in one node.

But you do understand the principal right? Like you set your criteria, and then pull a value that is outside of it (maybe the value is in a parent or the grandparent but not say a cousin (Parent or grandparent offspring following a totally different path of parents and children.))... I was trying to use the Xpath reference for 'start from the root' but it didn't work. Perhaps there could be a checkmark box somewhere that indicates wether or not the expression should be related to the context.

twistor’s picture

Status: Active » Fixed

Not sure if this is still an issue, but with the recent updates this is possible. You can now get back to the root of the document, so getting the url would look like "/siteData/warnings/@url". Hope this helps.

rbrownell’s picture

Awesome twistor! Thanks! :D

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.