Re: "valid" RDF in XML files

> I managed to do that by adding the following line to the Schema : 
> <xsd:any namespace="" 
>     minOccurs="0" maxOccurs="1"  
>     processContents="skip"/>
> which allows me to add a <rdf:RDF ....>....</rdf:RDF> tag in my XML file, at
> the
> location specified in the schema. An RDF parser finds the RDF information,
> and
> the XML validates correctly, I'm quite happy.
> My questions are : 
> - 1 : is this the good way to do such things?? Or do I need much more
> explanations about RDF and the way to use it?
> - 2 : If I want the included RDF information to be checked against a model,
> how
> should I proceed? Do I need RDF Schema???

Well you could go a bit further and have a definition of the rdf:RDF element 
(which in general should allow any elements from any namespace as content) and 
then allow that rather than any element from the RDF namespace. This would 
allow you to catch <you:someElement><rdf:Gibberish /></you:someElement>.

Really though that refinement is just frosting, so I wouldn't worry about it.

What exactly do you want to allow in terms of RDF?

If you want to allow arbitrary RDF/XML contnent then you can't go much further 
than that in your schema.

However you could define a fixed format for a fixed range of possible values 
such that, for example, the content could only be 1 dc:title element followed 
by 0 or 1 dc:description elements followed by 0 or more elements for a 
predicate of your own invention that has some purpose in your own application.

In such case XML Schemata could very rigourously validate the document, and 
while you lose flexibility you also gain a guarantee of what metadata will be 
present and arguably make it easier to teach people who to prepare documents in 
the format (ironically the freer the system the harder it can be to teach).

Jon Hanna
*Thought provoking quote goes here*

Received on Friday, 28 November 2003 11:40:34 UTC