XML jargon: declaration vs. definition

R

Razvan

Hi !





Consider the following XML element:

<!ELEMENT value (#PCDATA)>
<!ATTLIST value year CDATA #IMPLIED>

Is this a declaration or a definition ? In Java/C++ there is a clear
distinction between declaration and definition.
How about XML ?




Regards,
Razvan
 
R

Richard Tobin

Razvan said:
Is this a declaration or a definition ? In Java/C++ there is a clear
distinction between declaration and definition.
How about XML ?

XML doesn't have such a distinction. What would it mean?

-- Richard
 
R

Razvan

XML doesn't have such a distinction. What would it mean?

You can certainly imagine things, like: when an element
appears inside an xml instance it is declared, *but* if it is not
defined inside the associated DTD/"XML Schema" then you have an error.
The same if it is not properly defined.
I am not asking about "imaginative things" but about the state
of the matters. You are saying that I can interchangeably use the term
"definition" and "declaration" because they have the same meaning in
XML. CORECT ?



Regards,
Razvan
 
M

Martin Honnen

Razvan wrote:

I am not asking about "imaginative things" but about the state
of the matters. You are saying that I can interchangeably use the term
"definition" and "declaration" because they have the same meaning in
XML. CORECT ?

I don't think so, for instance the XML 1.0 specification here
<http://www.w3.org/TR/REC-xml/>
defines what "the XML declaration" in an XML document is e.g. the
<?xml version="1.0" encoding="UTF-8"?>
at the beginning of the document and that should be called "XML
declaration" then and not "XML definition".
An XML document can also contain a "document type declaration" and that
should be called that way and not "document type definition" as that is
something different, the XML document contains a <!DOCTYPE ...>
"document type declaration" node which contais or points to a grammar,
the DTD or "document type definition", see
<http://www.w3.org/TR/REC-xml/#sec-prolog-dtd>

So while the XML 1.0 specification uses both terms, "declaration" and
"definition", the proper term should be used in the proper context as
defined by the specification.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top