Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why you should avoid Notation Declarations ?  RSS feed

Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In an article by Mr. Kohsuke Kawaguchi found at:

he explains why notations should be avoided. The following XML Schema is provided:

<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe" />

<xsd:element name="picture2">
<xsd:extension base="xsd:hexBinary">
<xsd:attribute name="pictype">
<xsd:restriction base="xsd:NOTATION">
<xsd:enumeration value="jpeg"/>
<xsd:enumeration value="png"/>

The following XML is OK:

<picture pictype="jpeg"> ... </picture>

and so is this: (I tested with XML Spy 2005 and XSV 2.8-1)

<pic :p icture pictype="jpeg"> ... </pic :p icture>

but the author says that the later form is invalid:

But the following fragment is not valid even if the prefix "pic" is properly declared.

<pic:picture pictype="jpeg"> ... </pic:picture>

Confused? You have to write it as follows because it's a QName:

<pic:picture pictype="pic:jpeg"> ... </pic:picture>

Apparently it fails to serve its only reason for existing. There's really no
reason to use notations. Notations are for SGML.

Can somebody explain why notations are bad and they should be avoided ?

[ February 23, 2005: Message edited by: Razvan MIHAIU ]
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The author concludes at the end saying
Even worse, you can't detect this error in some validators because they think that those missing components may appear afterward.

may be xmlspy is one of it.
Have you checked with topologi schematron validator or with others. i guess refering w3c spec would be the best choice.

By the way..i see you have edited your post and added space between some letter to disable smilies that appear because of xml tags,instead you tick the check box that appear below the post submit button "Disable smilies in this post". That will remove the cause.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!