LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives


XML-L Archives

XML-L Archives


View:

Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font

Options:

Join or Leave XML-L
Reply | Post New Message
Search Archives


Subject: Re: Element relationships
From: "John E. Simpson" <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Mon, 4 Oct 1999 19:07:07 -0400
Content-Type:text/plain
Parts/Attachments:
Parts/Attachments

text/plain (63 lines)


At 03:25 PM 10/04/1999 -0700, Justin Vidler wrote:
>Is there a way to define relationships between different elements in
>separate structures?  For an example, say I have an XML document describing
>a file:
>
><EXAMPLE>
>     <FILE name="test.doc" id="112458">
>         <CONTENT>
>             <CREATOR>Joe</CREATOR>
>             <DATE_CREATED>10/4/99</DATE_CREATED>
>             <SUBJECT>New Policy</SUBJECT>
>         </CONTENT>
>         <FILE_INFO>
>             <DATE_CREATED>10/04/1999</DATE_CREATED>
>             <DATE_MODIFIED>10/04/1999</DATE_CREATED>
>             <SIZE>10234</SIZE>
>             <PATH>c:\shared\memos</PATH>
>         </FILE_INFO>
>     </FILE>
></EXAMPLE>
>
>If you notice, the element DATE_CREATED is in the FILE element in 2 places,
>under different sub-elements.  The data in the two elements has the same
>meaning, but is formatted different.  The DATE_CREATED element in the
>CONTENT and FILE_INFO elements are both defined differently in the DTD, even
>though they have the same meaning.  Is there a way to do a cross-reference
>between the two that would indicate that they have the same meaning,
>although the  actual data in them differs?

Not sure if this will help or not, but I've got one idea.

(Caveat: There's nothing intrinsic in XML that lets you perform any tricky
edits or cross-checks of the sort that I think you're really asking for. So
this is a kludge that might get you part of the way there, with compromises.)

You might define general entities representing all the valid month-day
combinations, and require that *they* be used rather than character
strings. E.g.:

   <!ENTITY Jan01 "01/01">
   <!ENTITY Jan02 "01/02">
         (etc.)
   <!ENTITY Dec31 "12/31">

So the dates in your example would look like this in the document:
   <DATE_CREATED>&Oct04;/1999</DATE_CREATED>

I don't know though; if you were in the position to require something like
this, then presumably you'd be in the position simply to require one date
format or the other. :)  And it doesn't help at all with the years, which
(depending on Y2K considerations) could still be represented in either YY
or YYYY format.

Are you asking about controlling the date format in general? Or do you
always want the value of the FILE_INFO date to *equal* that of the
DATE_CREATED?


=================================================
John E. Simpson
[log in to unmask]
http://www.flixml.org
Just XML - Now available from Prentice-Hall

Back to: Top of Message | Previous Page | Main XML-L Page

Permalink



LISTSERV.HEANET.IE

CataList Email List Search Powered by the LISTSERV Email List Manager