HTML child elements - how to define

Discussion in 'XML' started by A Amitkashaw, Nov 6, 2003.

  1. A Amitkashaw

    A Amitkashaw Guest

    Hello,

    As a new guy to XML I'm stuck on (what I perceive as) a trickey problem. I'm
    defining the element as so:

    <!ELEMENT brains (#PCDATA)>

    Within this element I have to be able to use HTML tags. XML being XML I can
    either define every single HTML tag as a child or try and find a quick way
    of doing it. I'd rather not have to define every single HTML tag that I
    would like to use. From what I've defined I can have only text within the
    tags BRAINS. I know there's a CDATA tag and <code> tags that can be used,
    but can I use these within the ELEMENT tag to define *all* following HTML
    tags?

    Thanks for your time.

    - S
    A Amitkashaw, Nov 6, 2003
    #1
    1. Advertising

  2. In article <k9rqb.5873$>,
    A Amitkashaw <> wrote:

    % As a new guy to XML I'm stuck on (what I perceive as) a trickey problem. I'm
    % defining the element as so:
    %
    % <!ELEMENT brains (#PCDATA)>
    %
    % Within this element I have to be able to use HTML tags.

    If you want to validate against your DTD, you need to define all the
    tags you're going to use. You can do this by including the XHTML
    DTD, something like this:

    <!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    %xhtml;

    You can then define the content depending on what bits of xhtml you
    need to use. For instance

    <!ELEMENT brains (html)>

    would allow (and require!) brains to include an entire html document.

    <!ELEMENT brains (#PCDATA|html|%Block;)*>

    would allow arbitrary text, an entire html document, or the content
    model of the HTML body element.

    --

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Nov 6, 2003
    #2
    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. Gerald Aichholzer
    Replies:
    2
    Views:
    2,499
    Gerald Aichholzer
    Jun 27, 2006
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,116
    David Schwartz
    Dec 9, 2003
  3. theotyflos
    Replies:
    3
    Views:
    468
    Thomas Matthews
    Feb 19, 2004
  4. robin liu
    Replies:
    3
    Views:
    821
    Robin Liu
    Apr 21, 2006
  5. Brian Takita

    #define _ and #define __

    Brian Takita, Jan 23, 2006, in forum: Ruby
    Replies:
    0
    Views:
    460
    Brian Takita
    Jan 23, 2006
Loading...

Share This Page