« External Data/004 » : différence entre les versions
De Semantic MediaWiki - Sandbox
Aucun résumé des modifications |
|||
(3 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 3 : | Ligne 3 : | ||
==#get_web_data== | ==#get_web_data== | ||
<pre>{{#get_web_data: | |||
url={{fullurl:External Data/004/source|action=raw}} | |||
|format=XML | |||
|use xpath | |||
|delimiter=, | |||
|data=Loman1=//body/div/p[@xml:id='Loman.10'],Loman2=//body/div/p[10],Comment=//comment | |||
}}</pre> | |||
{{#get_web_data: | {{#get_web_data: | ||
url={{fullurl:External Data/004/source|action=raw}} | url={{fullurl:External Data/004/source|action=raw}} | ||
Ligne 22 : | Ligne 30 : | ||
;Comment with paragraph tags | ;Comment with paragraph tags | ||
{{#external_value:Comment }} | {{#external_value:Comment }} | ||
Should have rendered | |||
<pre><comment><p>This comment has been added</p></comment></pre> | |||
==Conclusion== | ==Conclusion== | ||
.. | External Data's use of xpath cannot return: | ||
# internal XML tags as '''part''' of the desired string (Loman1, Loman 2 above), where the <w></w> tags are simply ignored | |||
# nested XML tags (here p tags) around the desired string (Comment above), which simply triggers an error message. (here: Error: no local variable "Comment" was set.) | |||
[[Category:External Data examples]] | [[Category:External Data examples]] |
Dernière version du 16 septembre 2017 à 11:29
Source
External Data/004/source - excerpt from http://www.asnc.cam.ac.uk/irishglossaries/xml/Loman.xml
#get_web_data
{{#get_web_data: url={{fullurl:External Data/004/source|action=raw}} |format=XML |use xpath |delimiter=, |data=Loman1=//body/div/p[@xml:id='Loman.10'],Loman2=//body/div/p[10],Comment=//comment }}
#external_value
- Loman1
.i. lot-te .i. lotan ar tige í 7 tess indti.
- Loman2
.i. lot-te .i. lotan ar tige í 7 tess indti.
- but really should have been
<w type="hw">Lite</w> .i. lot-te .i. lotan ar tige í 7 tess indti.
- Comment with paragraph tags
Erreur : aucune variable locale « Comment » n’a été définie.
Should have rendered
<comment><p>This comment has been added</p></comment>
Conclusion
External Data's use of xpath cannot return:
- internal XML tags as part of the desired string (Loman1, Loman 2 above), where the <w></w> tags are simply ignored
- nested XML tags (here p tags) around the desired string (Comment above), which simply triggers an error message. (here: Error: no local variable "Comment" was set.)