External Data/004

De Semantic MediaWiki - Sandbox

Source[modifier | modifier le wikicode]

External Data/004/source - excerpt from http://www.asnc.cam.ac.uk/irishglossaries/xml/Loman.xml

#get_web_data[modifier | modifier le wikicode]

{{#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[modifier | modifier le wikicode]

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[modifier | modifier le wikicode]

External Data's use of xpath cannot return:

  1. internal XML tags as part of the desired string (Loman1, Loman 2 above), where the <w></w> tags are simply ignored
  2. 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.)
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.