ID and tag value uniqueness, how?

Glenn R. Kronschnabl grk at arlut.utexas.edu
Wed Oct 28 18:25:35 GMT 1998


Hi,

I am doing a simple xml document that contains a list of action items.
I want each action item to have a *unique* number that can
automatically be validated during the parser process.  This unique
number should facilitate file integrity (give me an error when run
thru a processor if there are duplicate entries) and be printed out as
the identifier colument (think of an excel spreadsheet) when I print
out the list.  The question I am wrestling with is how is the best way
(or is there a way?) to automagically guarantee/enforce uniqueness?  I
thought I could use an ID attribute, and specify a number (see Method
1 below), of course THIS IS INCORRECT!  (ID's must start with a
'Letter').  I don't want to do something like id="num1" because then I
would have to parse it, etc.  Method 2 is simple, but I can't
automagically check for uniqueness unless I write special code.  Is it
possible to use XML and/or DTD and/or the parser to generate unique
ID's - I would think that would solve my (part of the) problem.  [Of
course, the numbering would change if an item got deleted, which is
probably a bad thing since once the number is assigned to an item it
should never change.]  Thanks for any ideas/comments.

Method 1

  <item id="1">
    <title>Modify acceptance test plan</title>
    <description>UT to modify acceptance test to
                 include additional tests</description>
    <assigned>
      <duedate>1998-10-15</duedate>
      <whom>Joe Bob</whom>
    </assigned>
    <summary status="closed">
      <resolution>Test plan modified and sumbitted for review</resolution>
      <date>1998-10-15</date>
      <whom>Joe Bob</whom>
    </summary>
  </item>

Method 2

  <item>
    <id>1</id>
    <title>Modify acceptance test plan</title>
    <description>UT to modify acceptance test to
                 include additional tests</description>
    <assigned>
      <duedate>1998-10-15</duedate>
      <whom>Joe Bob</whom>
    </assigned>
    <summary status="closed">
      <resolution>Test plan modified and sumbitted for review</resolution>
      <date>1998-10-15</date>
      <whom>Joe Bob</whom>
    </summary>
  </item>

Cheers,
Glenn                                  
--------------------
Glenn R. Kronschnabl
Applied Research Laboratories        | grk at arlut.utexas.edu (PGP/MIME ok)
The University of Texas at Austin    | http://www.arlut.utexas.edu/~grk
PO Box 8029, Austin, TX 78713-8029   | (Ph) 512.835.3642 (FAX) 512.835.3808
10,000 Burnet Road, Austin, TX 78758 | ... but an Aggie at heart!

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list