Generic XML display and query client
Last updated:
; since:
2000-11-27
This page has been developped as part of the "Worlwide Botanical
Knowledge Base" project, see :
http://wwbota.free.fr/
With this XPath demo page it is
possible to:
- change style and make queries without reloading the page from
server, so you can continue experimenting with queries when off-line
(this is one of the advantages of XML),
- display the Implicit Schema (that is, the arborescence of
elements and sub-elements) present in the data,
- make queries; try these:
- //Leaves ==> displays only
Leaves and sub-elements in all species
- //Leaves[//char = 'opposite']
==> displays only Leaves and sub-elements having a char (character)
sub-element being 'opposite'
- //species[Herbs]//Inflorescences
==> in the species being Herbs, displays only Inflorescences
sub-element
- species [ Shrubs ]
- //species [ Corolla/lobes/char [ contains(. , '4')]]
- //Branches[contains(char,'gray')]
- /descendant::species[child::Petiole/ child::char [
contains( ., 'glabrous')] ]
- generate XSLT queries with a quite generic GUI, taking in account
the actual content of the XML data
Notes:
- it works with both Mozilla > 1.2, Netscape 7 and Internet
Explorer 6
- with Internet Explorer < 6, IT WORKS ONLY with the patch
compliant with the XSLT and XPath W3C
Recommandations, downloadable at Microsoft
(look for MSXML). If you download and install (just execute it ounce)
the MSXML file, you will be able to use the whole range of the
specification of query expressions (XPath). The XPath W3C
Recommandations is at http://www.w3.org/TR/xpath.html
. A nice XPath tutorial is at http://www.zvon.org
- This page is actually generic, you can enter any file or URL
in the "XML data file" field; moreover you can use as an URL, with your
own data, like a server-side implementation, e.g.:
http://wwbota.free.fr/Generic/XMLClient.htm?URL=http://www.mycom.com/mydata.xml&xpath=//myElement
Try these URL's, which were taken from http://www.xmltree.com :
http://wwbota.free.fr/Generic/XMLClient.htm?URL=http://www.wired.com/news_drop/netcenter/netcenter.rdf
At least you could use it if you know how to bypass the
security feature of Mozilla that forbids accessing URL's from other
sites than the one where the script is coming from. Saying in the
Javascript:
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
doesn't work.
- The Diospyros descriptions are coming straight from
FloraParse out of the Flora of China.
- The table view and the "classic" view are not generic, but IE5
view is; that is, you can enter any XML URL, and no information will be
lost.
- Note how the "Implicit Schema" button gathers all features
present in all species. It is meant as a help to write XPath queries. Of
course the next stage is to write some code to write XPath queries in
the user's place.
Some Javascript + DHTML code has been added to have a GUI to help
generate XPath queries without having to copy-and-paste XPath strings
from the page.
For instance a general query in construction such as
/a[constraint1]/b[constraint2] |
<same thing>
is associated to pull-down menus:
- / or // or . or verbose axis
- b or other possible tags at same depth level
- for adding constraints a button inserts a GUI of the same kind as the
entry general query GUI, since a constraint's syntax is the same
as a general XPath string.
POSSIBLE DEVELOPMENTS:
- for a more ambitious architecture implying cooperation beetwen
browser and server, see specification for an application realizing a Specimen identification
- use Apache.org's Xalan
applet as XSLT engine; this will avoid use of a proprietary browser
technology