Well-formed XML question

Discussion in 'XML' started by Paul Flew, Jun 30, 2003.

  1. Paul Flew

    Paul Flew Guest

    Hi

    I'm sure this is a very simple question, but can someone tell me whether the
    following is a well-formed XML document (not withstanding the lack of DTD):

    <document>Some text <documentcomponent>Component Part</documentcomponent>
    some more text </document>

    i.e. Embedding a tag within the contents of another tag (a la HTML)?

    I'm writing a piece of software which takes a text document and returns
    those words within it which it identifies as particular components (date,
    etc), for which obviously the above format is potentially most suitable.

    Any help appreciated, even if its just pointing at a relevant FAQ.

    Regards,



    Paul

    ps. Remove the .nospam to respond directly.
     
    Paul Flew, Jun 30, 2003
    #1
    1. Advertising

  2. Paul Flew wrote:
    > Hi
    >
    > I'm sure this is a very simple question, but can someone tell me whether the
    > following is a well-formed XML document (not withstanding the lack of DTD):
    >
    > <document>Some text <documentcomponent>Component Part</documentcomponent>
    > some more text </document>


    It is.
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
     
    Johannes Koch, Jun 30, 2003
    #2
    1. Advertising

  3. Paul Flew <> wrote:

    > I'm sure this is a very simple question, but can someone tell me whether the
    > following is a well-formed XML document (not withstanding the lack of DTD):
    >
    ><document>Some text <documentcomponent>Component Part</documentcomponent>
    > some more text </document>



    Yes, it is well-formed.

    Why ask thousands of people around the world to spend grey-matter
    cycles on a question easily answered with silicon-cycles?

    ie. Why not run the document through an XML parser, and see what happens?


    > i.e. Embedding a tag within the contents of another tag (a la HTML)?



    That is *not* embedding a tag within a tag.

    Embedding a tag within a tag is not allowed in XML.

    Embedding an element within an element is allowed though.

    See the XML FAQ:

    http://www.ucc.ie:8080/cocoon/xmlfaq#makeup


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jun 30, 2003
    #3
  4. Paul Flew

    Micah Cowan Guest

    "Paul Flew" <> writes:

    > Hi
    >
    > I'm sure this is a very simple question, but can someone tell me whether the
    > following is a well-formed XML document (not withstanding the lack of DTD):


    The lack of DTD doesn't affect its well-formedness, only its "validity".

    > <document>Some text <documentcomponent>Component Part</documentcomponent>
    > some more text </document>
    >
    > i.e. Embedding a tag within the contents of another tag (a la HTML)?


    This doesn't affect the well-formedness or validity of an XML document
    (didn't you know that HTML has an extremely similar XML counterpart,
    XHTML?)

    -Micah
     
    Micah Cowan, Jul 5, 2003
    #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. Timo Nentwig

    parsing non-well-formed XML (SAX)

    Timo Nentwig, Jun 4, 2004, in forum: Java
    Replies:
    2
    Views:
    863
    Timo Nentwig
    Jun 4, 2004
  2. Rimu Atkinson

    how is this XML not well-formed???

    Rimu Atkinson, Jul 9, 2003, in forum: XML
    Replies:
    1
    Views:
    1,093
    Peter Flynn
    Jul 15, 2003
  3. Arpan
    Replies:
    2
    Views:
    441
    Arpan
    Aug 24, 2006
  4. seven.reeds
    Replies:
    2
    Views:
    705
    seven.reeds
    Jul 1, 2007
  5. Rich Fowler
    Replies:
    2
    Views:
    1,312
    Rich Fowler
    Jan 22, 2010
Loading...

Share This Page