Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
rbrownellThe 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.
Comment #2
rbrownellChanging title... hoping to make it more attractive.
Comment #3
rbrownellComment #4
twistor CreditAttribution: twistor commentedCurrently 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.
Comment #5
rbrownellNo 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.
Comment #6
twistor CreditAttribution: twistor commentedNot 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.
Comment #7
rbrownellAwesome twistor! Thanks! :D