Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Wellformedness in Xerces

Reply
Thread Tools

Wellformedness in Xerces

 
 
indo3
Guest
Posts: n/a
 
      08-29-2004
Hello

Is it right that a XML document is only wellformed if all
entity references can be resolved in the document? this would
mean that Xerces needs to retrieve external DTD files
to get entity definitions. I always thought
that to check on wellformedness, no external files would
be needed. And IF the document is wellformed and you
retrieve a DOM tree, then Xerces has replaced already all
entities with the "replacing text" or how it is called.
Is Xerces required to do this during the wellformedness-checking as
requirement of the XML 1.0 specification or can this
feature be turned off so that the entities are somehow
encoded in the text nodes of the DOM tree? And if this is
possible, are there any specs which define such an encoding?
I have the expression "unparsed entity" in mind, and this should
need to be represented in a DOM tree somehow (maybe I confused
some terms now..).

THANKS
 
Reply With Quote
 
 
 
 
Kenneth Stephen
Guest
Posts: n/a
 
      08-29-2004
indo3 wrote:

> Hello
>
> Is it right that a XML document is only wellformed if all
> entity references can be resolved in the document? this would

Hi,

Yes. Entity references have to be resolved for an XML document to be
well-formed. It is possible to define the entity definitions within the
document itself - so that there is no need to go get an external DTD
document to verify well-formedness.

Regards,
Kenneth
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      08-29-2004
In article <(E-Mail Removed) >,
indo3 <(E-Mail Removed)> wrote:

>Is it right that a XML document is only wellformed if all
>entity references can be resolved in the document?


Not exactly. In some circumstances an undeclared entity is only a
validity error. The idea of this is that a minimal parser doesn't
have to read anything but the main document (the document entity), so
if there is an external DTD it won't know whether it contains
declarations for entities.

If you want to check that all entities are defined, you need to use
a validating parser (or a non-validating parser that happens to read
the external subset).

If the document doesn't have an external DTD, or is declared be be
standalone, then all undeclared entities are a well-formedness error.

>I have the expression "unparsed entity" in mind


This is something quite different. Its main use is to refer to things
which aren't XML, such as JPEG images. You can only refer to unparsed
entities as attribute values, and a parser will not attempt to read
them.

-- Richard
 
Reply With Quote
 
Kenneth Stephen
Guest
Posts: n/a
 
      08-29-2004
Richard Tobin wrote:

> In article <(E-Mail Removed) >,
> indo3 <(E-Mail Removed)> wrote:
>
>
>>Is it right that a XML document is only wellformed if all
>>entity references can be resolved in the document?

>
>
> Not exactly. In some circumstances an undeclared entity is only a
> validity error. The idea of this is that a minimal parser doesn't
> have to read anything but the main document (the document entity), so
> if there is an external DTD it won't know whether it contains
> declarations for entities.
>

Richard,

I see that there is more to this than I had previously thought. Thanks
for the enlightening answer.

Kenneth
 
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
how do I check wellformedness of html files? drgonzo120 Java 9 10-17-2006 01:59 PM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
Solution for MissingResourceException in apache standard taglib with xerces Leo Sauermann Java 0 07-28-2003 12:29 PM
Sun ONE, The xerces problem (Sun One Oh my) Roy Benjamin Java 3 07-23-2003 08:32 PM
[dom4j & Xerces] How to show validation errors? Stefan Siegl Java 2 07-17-2003 12:26 PM



Advertisments