Hi Doug,
> I am new to the DC XML world, and I am looking for
> assistance, guidance, direction, or an answer if possible.
>
> Quick Question -
>
> Is it possible to have a XML file pull in another XML
> document (within the DC standard)?
>
> Details -
>
> I am working in an environment with 2 web servers. On server
> 1, I am handicapped because I am not allowed access to change
> any of the files or code on it (third-party software).
> Server 2 I have free reign.
>
> Server 1 is performing a number of primary functions and
> acting as the home page. On that home page are a number of
> links to server 2, and there is
> a "news archive" section. Currently, that news section
> points to a hard-
> coded file (XML DC standard), which is ultimately useless for
> my needs - Not the XML, just that it's hard-coded.
>
> Server 2 acts as the interface to saving news releated
> stories, and because I can program on server 2, I created a
> news XML generator.
>
> What I want to do is modify Server 1's xml file to
> include/pull in/grab the file found on Server 2 and use that
> for it's content.
I'm not sure I fully understand your question but I'll have a try at a
reply!
First - and apologies if I'm stating the obvious! - I'd just note that
an application consuming your XML documents over the Web doesn't need to
know anything about the server-side mechanisms you use to generate them.
If my application performs an HTTP GET for your URI
http://your.example.org/docs/abc.xml and your server returns an XML
document as a representation of the resource identified by that URI, my
application has no knowledge of whether that document was generated from
a static file on your server, or by a set of server-side includes or by
a server-side application issuing a query on a database and processing
the result set, or grabbing a set of other XML documents from around the
Web and processing them. As far as my application is concerned it issues
the GET and an XML instance is returned: the mechanics of how that
instance was generated are irrelevant/unknown (to my application).
OTOH, if you want my application to do the work of 'joining up the
pieces' of some XML document that you serve, I guess there are several
options:
(i) XML itself provides some mechanisms for this sort of thing with
"external entities"
http://www.w3.org/TR/REC-xml/#sec-external-ent
So e.g. you could serve something like (I'm not guaranteeing that this
is completely syntactically correct - also my memory of the ways this
interacts with XML Schema processing is a bit hazey, but I _think_ it's
OK!)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE your:metadata [
<!ENTITY otherstuff SYSTEM
"http://yourother.example.org/parts/xyz.xml">
]>
<your:root xmlns:your="http://your.example.org/formats/dc-xml/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:foo="....."
>
&otherstuff;
</your:root>
In this case it is the XML parser that does the work of processing the
external reference.
(ii) Use XInclude
http://www.w3.org/TR/xinclude/
In this case the inclusion processing is done after parsing and you are
relying on the processing application to support XInclude, and there are
some complexities involving the relationship between XInclude processing
and validation. See e.g. the comments in the XML.com article here
http://www.xml.com/pub/a/2002/07/31/xinclude.html
(iii) Use some mechanism specific to your XML format
<your:include stuff="http:http://yourother.example.org/parts/xyz.xml" />
Again that relies on the processing application "knowing" what to do
with that XML element in your XML format. The XML format provided by
DCMI for DC metadata does not define any such mechanism.
Pete
---
Pete Johnston
Technical Researcher, Eduserv Foundation
Web: http://www.eduserv.org.uk/foundation/people/petejohnston/
Weblog: http://efoundations.typepad.com/efoundations/
Email: [log in to unmask]
Tel: +44 (0)1225 474323
|