What, exactly, is the 'qualified name' in a DTD declaration?

S

Simon Brooke

The documentation for org.w3c.dom.DOMImplementation.createDocumentType says
helpfully:

public DocumentType createDocumentType(java.lang.String qualifiedName,
java.lang.String publicId,
java.lang.String systemId)
throws DOMException

and goes on to explain:

Parameters:
qualifiedNameThe - qualified name of the document type to be created.

On a 'monkey see, monkey do' basis I've been supplying the string 'html'
for XHTML documents, and since I've not generated DTD declarations when
generating other kinds of documents not thought any more about it. But
what does the 'qualified name' mean, and in what way is it 'qualified'? In
particular, how does one establish what the correct qualified name is for
a particular public id, private id pair - or doesn't it matter? Could I
just use 'froboz' and have it all still work?

If it does matter, is 'html' actually right?

--
(e-mail address removed) (Simon Brooke) http://www.jasmine.org.uk/~simon/

;; So, before proceeding with definitive screwing, choose the
;; position most congenital.
-- instructions for fitting bicycle handlebars
 
R

Richard Tobin

Simon Brooke said:
Parameters:
qualifiedNameThe - qualified name of the document type to be created.

Presumably it's the name of the top-level element; as in

<!DOCTYPE name [...]>

"Qualified" means that it's a QName - it can have a namespace prefix -
though namespaces are not well-supported by DTDs.

-- Richard
 
S

Simon Brooke

Richard Tobin said:
Simon Brooke said:
Parameters:
qualifiedNameThe - qualified name of the document type to be
created.

Presumably it's the name of the top-level element; as in

<!DOCTYPE name [...]>

That's my guess too. Can I rely on that? If so, would it be reasonable to
have a hashmap that mapped from top-level elements to public/system ids,
and cache them as seen?
 
J

Joseph Kesselman

The only usage of "qualified name" that I know of in the XML world is
indeed the one defined by the XML Namespaces spec.
If so, would it be reasonable to
have a hashmap that mapped from top-level elements to public/system ids,
and cache them as seen?

I'm not sure what you're asking. If you're asking whether the
public/system ID can be stored along with a particular cached document
-- sure, that's a legitimate part of the XML Infoset. If you're asking
whether a given top-level element name will always have the same
public/system IDs, emphatically not, since that depends on how the
individual document was retrieved and what its contents are... and, if
you're going to do namespace-aware processing, on which namespace the
prefix part of that URI was bound to.

But I suspect I've misunderstood your question.
 
R

Richard Tobin

Joseph Kesselman said:
I'm not sure what you're asking. If you're asking whether the
public/system ID can be stored along with a particular cached document
-- sure, that's a legitimate part of the XML Infoset. If you're asking
whether a given top-level element name will always have the same
public/system IDs, emphatically not

Nor is the reverse true: many DTDs are written with a particular
top-level element in mind, but there is no way to require it - you can
write a perfectly DTD-valid document using the XHTML public and system
IDs that has <p> as its top-level element:

<!DOCTYPE p PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<p>a simple paragraph</p>

- which only goes to show that validation isn't everything.

-- Richard
 
S

Simon Brooke

Joseph Kesselman said:
The only usage of "qualified name" that I know of in the XML world is
indeed the one defined by the XML Namespaces spec.


I'm not sure what you're asking. If you're asking whether the
public/system ID can be stored along with a particular cached document
-- sure, that's a legitimate part of the XML Infoset. If you're asking
whether a given top-level element name will always have the same
public/system IDs, emphatically not, since that depends on how the
individual document was retrieved and what its contents are... and, if
you're going to do namespace-aware processing, on which namespace the
prefix part of that URI was bound to.

But I suspect I've misunderstood your question.

No, I regret to confess you did not.
 

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top