cardinal74 scripsit: > How do I associate a namespace with a file containing its definition > in RELAX NG?
You don't. You associate one or more schema definition files with a document to be validated (there is no standard way to do this as yet, so you specify the document and the schema to the validator). > If I were to attempt this in RELAX NG, how can I define the schema > that http://foo/Artist refers to? For instance, > > Song.rng > <?xml version="1.0" encoding="UTF-8"?> > <grammar xmlns="http://relaxng.org/ns/structure/1.0" > xmlns:art="http://foo/Song"> > <start> > <element name="Song"> > <element name="Title"><text/></element> > <element name="Year"><text/></element> > <element name="Artists"> > <element name="art:Artist"/> > </element> > </element> > </start> > </grammar> > > Where "art:Artist" is indicated, how could I pull in the contents of > this file (with namespaces enforced?) The "include" element pulls an auxiliary file containing a grammar into the main grammar. There is nothing that says all namespace-specific definitions have to be in one file, but there is nothing that says they can't be, either. > Artist.rng > <?xml version="1.0" encoding="UTF-8"?> > <grammar xmlns="http://relaxng.org/ns/structure/1.0" ns="http://foo/Artist"> > <element name="Artist"> > <element name="FirstName"> > <text/> > </element> > <element name="LastName"> > <text/> > </element> > <element name="BirthYear"> > <text/> > </element> > </element> > </grammar> This is not a valid grammar element, because grammar elements can only contain defines (which define patterns) and includes (which import the definitions of patterns). If you omit the grammar element, you can import the pattern using an externalRef element. -- John Cowan http://ccil.org/~cowan co...@ccil.org Mr. Henry James writes fiction as if it were a painful duty. --Oscar Wilde