that is because an id is considered as an xml-name and according to the specs (www.w3.org):
 
[Definition: A Name is a token beginning with a letter or one of a few punctuation characters, and continuing with letters, digits, hyphens, underscores, colons, or full stops, together known as name characters.] Names beginning with the string "xml", or any string which would match ((’X’|’x’) (’M’|’m’) (’L’|’l’)), are reserved for standardization in this or future versions of this specification.
 
Therefore, starting with 0 or 1 is not correct.
 
The fact that it works in IE only means that your XML document is WELL-FORMED, not that it is VALID. If you install MS-IE TOOLS, you will be able to validate your document easily, then it will tell you that "A name was started with an invalid character".
 
Olivier
-----Original Message-----
From: pierre feuilloley [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 10:06 AM
To: [EMAIL PROTECTED]
Cc: ROUX Christian
Subject: About Element attribute name

Hello,
 
I have a trouble about an XML file and two Xerces examples (Sax2count, and Domcount).
I'm testing on PC with NT4 sp5, I'm using xerces 1.40 binary and examples, and visual c++ 6.0 sp4.
 
XML file:
 
<?xml version='1.0' encoding="UTF-8" ?>
<!DOCTYPE Dictionnary [
<!ELEMENT Dictionnary (category)+>
<!ELEMENT category (action)+>
<!ATTLIST category id ID #REQUIRED>
<!ATTLIST action what (add|delete) #REQUIRED>
<!ELEMENT action (content)+>
<!ELEMENT content (#PCDATA)>
]>
 
<Dictionnary>
  <category id="0">
    <action what="add">
      <content>JOURX.DET.CUM.</content>
    </action>
    <action what="add">
      <content>JOURX.DET.CUM.</content>
    </action>
  </category>
  <category id="1">
    <action what="add">
      <content>000001</content>
      <content>000002</content>
      <content>000003</content>
      <content>000004</content>
    </action>
  </category>
</Dictionnary>
when I'm executing Sax2count or Domcount (F:\xerces\xerces-c1_4_0-win32\bin>sax2count f:\temp\test.xml), I have this message:
 
Error at file f:\temp\test.xml, line 12, char 20
  Message: The values for attribute 'id' must be names or name tokens
 
Can tell me why I can't use "0" for Id attribute of category.
 
When I'm testing successfully this file with Internet explorer 5 and Notepad Xml.
 
Best Regard.
 
Pierre FEUILLOLEY
 
Docubase Systems
116, rue d'Aguesseau - BP 405
92103 BOULOGNE BILLANCOURT - France
*(33) 01 49 09 22 85
[EMAIL PROTECTED]

Reply via email to