GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Validator
  • E-invoice
  • Schemas
  • XML formatter Pretty-print or minify XML
  • XML viewer A document as a tree you can search
  • XML to PDF Any XML as a readable PDF
  • XML to JSON Arrays where the XSD allows
  • XPath tester XPath 3.1, matches with their lines
  • JSON to XML @keys as attributes, arrays repeated
  • XSLT transformer XSLT 3.0 with SaxonJS
  • XML to CSV Invoice lines and records as rows
  • XML diff Compare two documents as trees
  • XSD generator An XML Schema from sample XML
  • XML from XSD A sample document from a schema

This view

  • Original page
  • New address

GeezerVison is showing xmlvalid.com — “No declaration for attribute”: XML error explained | xmlvalid

No declaration for attribute

The DTD does not declare an attribute the element carries

The message, as the validator reports it
No declaration for attribute lang of element note

Why it happens

  • An attribute the DTD does not know, a misspelling, or an attribute meant for another element.

How to fix it

Remove or rename the attribute, or add it to the element's <!ATTLIST …> in the DTD.

Example

Validated against note.dtd, below.

Reports the error
<note id="n1" lang="en">
  <to>Ana</to>
  <body>Hi</body>
</note>
Fixed
<note id="n1">
  <to>Ana</to>
  <body>Hi</body>
</note>
note.dtd
<!ELEMENT note (to, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT body (#PCDATA)>
<!ATTLIST note id ID #REQUIRED>

Check your document

The validator lists every problem with its line and column, and links the ones explained here. It runs in your browser; nothing is uploaded

Open the validator

More DTD errors

  • No declaration for element
  • Element content does not follow the DTD
  • Element does not carry attribute
All error messages →
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.