MS said:
I am brand new to XML and doing some practice stuff. I am missing a
simple concept and I am hoping someone can shed some light.
I am learning how to tie in HTML and XML but everything I have done so
far, the XML file has resided in the same directory on my local pc.
Can you retrieve or view XML files via the web from another location
Yes, just upload them to your web server. Make sure your server operator
or webmaster has set the mime.types file to serve .xml files correctly
(see the FAQ for details:
http://www.ucc.ie/xml)
You'll need to write a CSS stylesheet to go with them, otherwise they
will be displayed unformatted. Browsers have no built-in formatting rules
for XML like they do for HTML, so a stylesheet is essential if you want
the document formatted.
and display them in an HTML document using nothing but HTML?
To do this you have three choices:
a) use XML files with XSLT stylesheets on with server that does XML to HTML
conversion, such as AxKit, Cocoon, or PropelX.
b) use XML files with XSLT stylesheets that get downloaded by the user's
browser and converted in the browser (currently restricted to recent
browsers only: MSIE5/6, Mozilla Firefox, Opera [Safari and Konqueror
to follow soon, I believe]) so users of older browsers will be SOOL.
c) use XHTML, but serve the file as MIME type text/hmtl. This is enough
to fool most browsers, but you are imposing quite severe restrictions
on yourself in terms of data identity and document management by using
XHTML (unless you actually use some other form of XML and convert to
XHTML statically before serving).
If so, how do you query this data?
That's a different thing altogether. If you just want to let users search
it, you'll need an XML search engine (there's one with Cocoon called Lucene)
but if you want them to be able to construct programmatic queries, you can
either program an interface to let them do it (which means scripting the
response-handler) or you can provide a selection of pre-programmed queries
(eg in XSLT) to which they can provide data values. XQuery provides a
syntax, but you'll need to write the surrounding code.
///Peter