Well-formed XML question

P

Paul Flew

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.
 
J

Johannes Koch

Paul said:
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.
 
T

Tad McClellan

Paul Flew said:
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
 
M

Micah Cowan

Paul Flew said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top