Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Are schemas better than DTDs for defining entities?

Reply
Thread Tools

Are schemas better than DTDs for defining entities?

 
 
Curious
Guest
Posts: n/a
 
      05-20-2007
Defining your own Entities in a DTD is rather pointless because Firefox &
certain other browsers don't read the DTD.
Is there a similar mechanism in schemas which works for all browsers?

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      05-20-2007
> Is there a similar mechanism in schemas which works for all browsers?

Entities are one of the DTD features which was *not* carried forward to
Schemas. The assumption was that people would use other mechanisms --
XInclude, inline XPointer, possibly stylesheet-assisted -- to implement
named-block/macro referencing. Or do server-side inclusion.

I haven't done a survey recently, so I don't know what's safe to assume
for "all browsers". But one of those standards-based approaches might do
the job for you.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      05-20-2007
* Curious wrote in comp.text.xml:
>Defining your own Entities in a DTD is rather pointless because Firefox &
>certain other browsers don't read the DTD.


They do, if you put the code in the internal subset rather than in some
external document. There is no other way, except perhaps using scripts
that dynamically load content, but then I am not sure what the point is.
--
Björn Höhrmann · (E-Mail Removed) · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      05-20-2007
Curious wrote:
> Defining your own Entities in a DTD is rather pointless because Firefox &
> certain other browsers don't read the DTD.


Browsers don't read an external DTD. Declared entities appear to work in
browsers if you put the DTD in the internal subset of the document. In
general, browser support for XML at the moment is poor and should be
avoided in favour of server-side support where possible.

> Is there a similar mechanism in schemas which works for all browsers?


Not as such. W3C Schemas don't have a concept of entities. XML entities
were inherited from SGML, and they continue to be important for normal
text document work, but W3C Schemas are targeted more at describing data
structures than text documents.

///Peter
--
XML FAQ: http://xml.silmaril.ie/


 
Reply With Quote
 
Curious
Guest
Posts: n/a
 
      05-20-2007
I tried defining an entitiy in the internal dtd using the files "simple.xml"
and "navbar.xml" shown below. This did not work with Firefox 2.0.0.3. Only
the title text was displayed.

simple.xml file
--------------
<?xml version="1.0"?>
<!DOCTYPE book SYSTEM "book.dtd"[
<!ENTITY navbar SYSTEM "navbar.xml">
]>
<book>
<title>The Wit and Wisdom of George W. Bush</title>
&navbar;
</book>


navbar.xml file
---------------
<h1>This is the navbar text</h1>



Curious.


"Bjoern Hoehrmann" <(E-Mail Removed)> wrote in message
news(E-Mail Removed) n.hoehrmann.de...
> * Curious wrote in comp.text.xml:
> >Defining your own Entities in a DTD is rather pointless because Firefox &
> >certain other browsers don't read the DTD.

>
> They do, if you put the code in the internal subset rather than in some
> external document. There is no other way, except perhaps using scripts
> that dynamically load content, but then I am not sure what the point is.
> --
> Björn Höhrmann · (E-Mail Removed) · http://bjoern.hoehrmann.de
> Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
> 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/


 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      05-21-2007
In article <7K44i.4024$(E-Mail Removed)>,
Curious <(E-Mail Removed)> wrote:

>I tried defining an entitiy in the internal dtd using the files "simple.xml"
>and "navbar.xml" shown below. This did not work with Firefox 2.0.0.3. Only
>the title text was displayed.


> <!ENTITY navbar SYSTEM "navbar.xml">


I don't think most browsers read external entities any more than they
read the external subset. It would probably have worked if you did

<!ENTITY navbar "<h1>This is the navbar text</h1>">

though that may not be much use to you.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GL2 better than the XLs? Consumer grade HDs better than pro-sumer Mini DVs? dh@. DVD Video 1 08-28-2008 07:20 PM
Why do we need XML Schemas other than for automatic validation? Water Cooler v2 XML 3 05-18-2008 10:55 AM
Is splint really better than lint? Is there a better tool than splint? Peter Bencsik C Programming 2 09-21-2006 10:02 PM
defining or not defining destructors johny smith C++ 8 07-02-2004 08:51 AM
Good SGML DTD viewer *or* tool for translating SGML DTDs to XML DTDs Clifford W. Racz XML 4 02-13-2004 06:24 PM



Advertisments