www.webdeveloper.com
Results 1 to 5 of 5

Thread: Dtd Help

  1. #1
    Join Date
    Dec 2004
    Posts
    6

    Dtd Help

    Hi

    I am new to the xml and I am not being able to do what I want. Here's my problem.

    in my DTD i have an element tag like this

    <!ELEMENT code (#PCDATA)>

    and when in the xml file i write the following

    <code>
    print( "<br>hello world<br>" );
    </code>

    my problem is that this document isnt valid because it detects the <br> tag as a child of <code>. so my question is, is there anyway I can make the parser/validator ignore the tags in quotes. if not how can i get around it?

    pls help

    thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    <!ELEMENT code (#CDATA)>

    <code>
    <![CDATA[
    print( "<br>hello world<br>" );
    ]]>
    </code>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Dec 2004
    Posts
    6
    when i write <!ELEMENT code (#CDATA)> in the DTD it gives me an error (xmlspy).

    and it wont always be "print( "<br>hello world<br>" );" it could be anything, but in quotes

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Forgive me, I believe that should be <!ELEMENT code (#PCDATA)>

    But you still want to use <![CDATA[ ]]> to keep the parser from getting confused.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Dec 2004
    Posts
    6
    ohhh i get it now, it works, thanks a lot

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles