Last modified: 2013-03-11 19:20:32 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T47805, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45805 - The format of the data parameter conflicts with xpath
The format of the data parameter conflicts with xpath
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ExternalData (Other open bugs)
REL1_19-branch
All All
: Unprioritized normal (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-06 20:45 UTC by Dan Bolser
Modified: 2013-03-11 19:20 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dan Bolser 2013-03-06 20:45:01 UTC
Given this snippet of XML:
    <PROP name="cors" val="valox"/>
    <PROP name="spec" val="DAS"/>

The following XPath should select the value 'valid':
    //PROP[@name='cors']/@val

You can confirm this using xmlstarlet:
    # gives 'valox'
    xmlstarlet sel -t -v "//PROP[@name='cors']/@val" -n snippet.xml

However, the = sign in the XPath messes with the way the data parameter takes values, namely as key=value pairs separated by commas. i.e. here is how my call looks:

{{#get_web_data:url=http://www.dasregistry.org/das/sources
  |format=XML
  |use xpath
   |data=title=//@title,description=//@description,sourcesDoc=//PROP[@name='sourcesDoc']/@value
}}


I'm seeing 'external_values' for the title and description local variables, but not the sourcesDoc (which shows up 'blank').
Comment 1 Dan Bolser 2013-03-09 01:06:31 UTC
Actually, investigating this, the = and , separators in the data parameter are fine, the issue here is simply the case of the XML attribute in question, sourcesDoc in this case...

Complex XPATH works fine in the data string, except when the attribute is mixed case...

 | data=description=//@description,TITLE=//@title,spec=//prop[@name='spec']/@value,sourcesdoc=//prop[@name='sourcesDoc']/@value,sources=//prop[@name='sources']/@value,alertMe=//prop[@name='alertMe']/@value

Only alertMe and sourcesDoc fail!
Comment 2 Dan Bolser 2013-03-09 01:08:17 UTC
{{#get_web_data: url=http://localhost/~dbolser/sources-formatted.xhtml
 | format=xml
 | use xpath
 | data=description=//@description,TITLE=//@title,spec=//prop[@name='spec']/@value,sourcesdoc=//prop[@name='sourcesDoc']/@value,sources=//prop[@name='sources']/@value,alertMe=//prop[@name='alertMe']/@value
}}

* {{#external_value:description}}
* {{#external_value:TITLE}}
* {{#external_value:spec}}
* {{#external_value:sources}}
* {{#external_value:TITLE}}
* {{#external_value:sourcesdoc}}
* {{#external_value:alertMe}}

Only sourcesdoc and alertMe EVs fail to return values.

The XML looks like this:

<sources>
<source uri="DS_112" title="structure" description="A reference server for protein structure annotations. Serves 3D coordinates of protein structures.">
<maintainer email="andreas.prlic@gmail.com"/>
<version uri="DS_112" created="2005-03-21T16:33:59+0000">
<coordinates uri="http://www.dasregistry.org/dasregistry/coordsys/CS_DS7" source="Protein Structure" authority="PDBresnum" test_range="1.10.8.10-SSG5-1">PDBresnum,Protein Structure</coordinates>
<capability type="das1:structure" query_uri="http://das.sanger.ac.uk/das/structure/structure"/>
<prop name="sources" value="valid"/>
<prop name="cors" value="valid"/>
<prop name="error-segment" value="valid"/>
<prop name="structure" value="valid"/>
<prop name="entry_points" value="valid"/>
<prop name="spec" value="DAS/1.6E"/>
<prop name="leaseTime" value="2012-12-13T13:16:00+0000"/>
<prop name="alertMe" value="1"/>
<prop name="sourcesDoc" value="http://das.sanger.ac.uk/das/"/>
<prop name="projectName" value="test for windows"/>
<prop name="projectDesc" value="windows test of image upload"/>
<prop name="projectIcon" value="http://www.dasregistry.org/ProjectIcon?id=86"/>
<prop name="projectHome" value="http://www.google.com"/>
</version>
</source>
Comment 3 Dan Bolser 2013-03-11 17:34:18 UTC
My suggested fix (entirely from discussion with Yaron):

When parsing the data field in ED_ParserFunctions.php, the call should actually be to "paramToArray( $args['data'], false, false )" in the case of using XPath!


This should be simple enough to implement. I'll submit a patch at some point (if you don't beat me to it).
Comment 4 Yaron Koren 2013-03-11 19:20:32 UTC
This is now fixed in the Git code, as far as I know - marking it as "fixed".

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links