XML Schema Validation : Invalid 'id' attribute value

XML Schema Validation : Invalid 'id' attribute value

Post by Serge » Wed, 06 Nov 2002 08:10:38



Aha, I've struggled with inconsistencies between
XmlValidatingReader and XML Spy for quite a while.
Finally, someone from Microsoft told me that XML Spy does
not respect W3C recommendations that much.

Here are more descrepancies:
  --Unique, Key, Keyref contraint validation seems to fail
with dotnet validator. The secret was that you must
include namespace prefixes into xpath expressions in the
Schema, used to locate pieces of document.
  --XmlDocument.SelectNodes() doesn't seem to work. But if
you use XmlNamespaceManager, it will...

XmlSpy validator should not be used as a reference one!

Quote:>-----Original Message-----
>When I try to validate this document in Visual Studio Dot
Net or in VB Dot
>Net code, I get the following error and the document will
not continue
>validation.

>ERROR: Invalid 'id' attribute value - The ' ' character,
hexadecimal value
>0x20, cannot be included in a name.. An error occurred at
>http://www.dfes.gov.uk/datacollection/ctf/schemas/ctf2002.
xsd(4, 2).

>This is caused by the spaces in the schema id.

>If I validate this in XMLSpy I don't get this problem.

>There are validation error's in this file but this should
not be one of
>them.

>Can anyone help.

>Thanks

>Rob.

 
 
 

XML Schema Validation : Invalid 'id' attribute value

Post by Dare Obasanj » Wed, 06 Nov 2002 15:54:06


According to the W3C XML Schema recommendation part 2: Datatypes at
http://www.w3.org/TR/xmlschema-2/#ID

"[Definition:]   ID represents the ID attribute type from [XML 1.0 (Second
Edition)]. The value space of ID is the set of all strings that match
the NCName production in [Namespaces in XML]. The lexical space of ID is
the set of all strings that match the NCName production in [Namespaces in
XML]. The base type of ID is NCName. "

The Namespaces in XML recommendation defines the production for NCName in
http://www.w3.org/TR/REC-xml-names/#NT-NCName as

      [4]  NCName ::=  (Letter | '_') (NCNameChar)* /*  An XML Name, minus
the ":" */
      [5]  NCNameChar ::=  Letter | Digit | '.' | '-' | '_' | CombiningChar
| Extender

BOTTOM LINE: Space is not a valid character within an ID

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:> When I try to validate this document in Visual Studio Dot Net or in VB Dot
> Net code, I get the following error and the document will not continue
> validation.

> ERROR: Invalid 'id' attribute value - The ' ' character, hexadecimal value
> 0x20, cannot be included in a name.. An error occurred at
> http://www.dfes.gov.uk/datacollection/ctf/schemas/ctf2002.xsd(4, 2).

> This is caused by the spaces in the schema id.

> If I validate this in XMLSpy I don't get this problem.

> There are validation error's in this file but this should not be one of
> them.

> Can anyone help.

> Thanks

> Rob.


 
 
 

1. Character '<', hexdecimal value 0x3c is illegal in XML attribute values

Hi

I keep getting this stupid error message: Character '<', hexdecimal
value 0x3c is illegal in XML attribute values.

This is the line of code it objects to:

<input type="hidden" name="id" id="id" value="<?php print $id;?>"></
input>

It does not like the <?php tag, which is tough because it is what we
want it to do.

Why is it evaluating it as XML? Its a php document.

And how do I get rid of these stupid compiler messages.

2. Is Zone Alaram Pro enough for a single PC?

3. BUG: Schema Validation Fails when it shouldn't (System.Xml.Schema.XmlSchemaCollection.Add)

4. BITMAP in Allegro

5. System.Xml.XmlException: ' ', hexadecimal value 0x01 , is an invalid character

6. Psion S5, PsiWin and MS Office 2000

7. Error emitting 'attribute' attribute -- 'reason' CS0647

8. XML Spy Considers XSD.EXE-generated schema's invalid

9. Validation error: Unable to find control id referenced by the 'ControlToValidate' property

10. HELP: Serialization error: "' ', hexadec imal value 0x06, is an invalid character

11. How: Changing the look of the 'Invalid Property Value' warning in a PropertyGrid?