Wellformedness in Xerces

Discussion in 'XML' started by indo3, Aug 29, 2004.

  1. indo3

    indo3 Guest

    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
    indo3, Aug 29, 2004
    #1
    1. Advertising

  2. 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
    Kenneth Stephen, Aug 29, 2004
    #2
    1. Advertising

  3. In article <>,
    indo3 <> 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
    Richard Tobin, Aug 29, 2004
    #3
  4. Richard Tobin wrote:

    > In article <>,
    > indo3 <> 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
    Kenneth Stephen, Aug 29, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    2
    Views:
    736
    David Zimmerman
    Jul 17, 2003
  2. Roy Benjamin
    Replies:
    3
    Views:
    532
    Mike Schilling
    Jul 23, 2003
  3. Leo Sauermann
    Replies:
    0
    Views:
    1,121
    Leo Sauermann
    Jul 28, 2003
  4. cvissy
    Replies:
    0
    Views:
    603
    cvissy
    Nov 16, 2004
  5. drgonzo120
    Replies:
    9
    Views:
    494
    Oliver Wong
    Oct 17, 2006
Loading...

Share This Page