Print

Print


Peter Flynn wrote:

> > (1)  Do XML files have to have the suffix ".xml", or is it just convention?
>
> Convention, but IMHO it would be rather pointless to use something else.
> Servers can of course be configured to serve out files labelled text/xml
> or application/xml for any given set of filetypes.

I think it would be very useful to use something else.  Many XML applications are written to process XML files that use a particular DTD.  Such applications can't process anything else, and using an application-specific file extension is one way to identify which files are available for the application to process.  For example, we use (by convention) .xsc to identify XSchema files.

> > (2)  Suppose that you want to define in a DTD an element that contains
> > string data (i.e., #PCDATA) followed by a single element.  It is my
> > understanding that the following is INCORRECT:
> >
> > <!ELEMENT elem1 (#PCDATA, elem2)>
> >
> > Is my understanding correct, i.e., that it is incorrect?
>
> Yes, there's nothing wrong with that, syntactically, except you need
> to be very careful of pernicious mixed content, eg
>
>    <elem1>foo bar <elem2>blort</elem2>
>    </elem1>
>
> is invalid because the newline after the end of elem2 is regarded as
> more character data and your content model forbids it.

Not true.  This is not a legal content model in XML.  See production [51].  Your best bet here is probably two define elem1 as having exactly two subelements, where the first has a PCDATA-only content model.

-- Ron Bourret