Web Analytics Made Easy -
StatCounter Creating DTD's - CodingForum

Announcement

Collapse
No announcement yet.

Creating DTD's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating DTD's

    Hi all, i would like to create a DTD for some webpages and the corresponding XML schema and XSL. Any ideas? Thanks

  • #2
    DTDs at w3chools.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

    Comment


    • #3
      Hmm, ZVON <http://www.zvon.org/> has a number of useful tutorials and references. <http://www.garshol.priv.no/download/xmltools/> has a load of tools.
      liorean <[[email protected]]>
      Articles: RegEx evolt wsabstract , Named Arguments
      Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
      Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

      Comment


      • #4
        Thanks,
        I have created a XML document and i would like to create the corresponding DTD's. Any ideas?

        <?xml version="1.0"?>
        <User>
        <Student>StudentID</Student>
        <Lecturer>LecturerID</Lecturer>
        <Module>
        <StudentModules>Student/Course/Module</StudentModules>
        <StaffModules>Lecturer/course/Module</StaffModules>
        <Course>Course/Module
        <Assignment>Assignment Task</Assignment>
        <Mark>Student/Course/Module/Mark</Mark>
        </Course>
        </Module>
        </User

        Comment


        • #5
          You aren't describing in well enough for me to know exactly what you want, but here's a simple sample DTD (Just elements, no attributes or entities.)

          <!ELEMENT User (Student | Lecturer | Module)+>
          <!ELEMENT Student (#PCDATA)>
          <!ELEMENT Lecturer (#PCDATA)>
          <!ELEMENT Module (StudentModules | StaffModules | Course)+>
          <!ELEMENT StudentModules (Student | Course | Module)+>
          <!ELEMENT StaffModules (Lecturer | Course | Module)+>
          <!ELEMENT Course (Assignement | Mark)>
          <!ELEMENT Assignment (#PCDATA)>
          <!ELEMENT Mark (Student | Course | Module | #PCDATA)>
          liorean <[[email protected]]>
          Articles: RegEx evolt wsabstract , Named Arguments
          Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
          Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

          Comment


          • #6
            Thanks i was basing the XML on the diagram which is attached. Basically when a student or lecturer logs in they can look at thier module details and see marks etc. The diagram should explain it better. I hope the XML is right for the diagram.
            Last edited by sagat; Feb 17, 2004, 05:34 AM.

            Comment


            • #7
              I tried creating the DTD and i kept getting errors.

              <?xml version="1.0" encoding="UTF-8"?>

              <!ELEMENT User (Student | Lecturer | Module)+>
              <!ELEMENT Student (#PCDATA)>
              <!ELEMENT Lecturer (#PCDATA)>
              <!ELEMENT Module (StudentModules | StaffModules | Course)+>
              <!ELEMENT StudentModules (Student | Course | Module)+>
              <!ELEMENT StaffModules (Lecturer | Course | Module)+>
              <!ELEMENT Course (Assignement | Mark)>
              <!ELEMENT Assignment (#PCDATA)>
              <!ELEMENT Mark (Student | Course | Module | %PCDATA>

              <!ATTLIST Student CDATA %REQUIRED;>
              <!ATTLIST Lecturer CDATA %IMPLIED;>
              <!ATTLIST Student Modules CDATA #IMPLIED>
              <!ATTLIST Staff Modules CDATA #IMPLIED>
              <!ATTLIST Assignment Task CDATA #IMPLIED>

              ]>
              Last edited by sagat; Feb 11, 2004, 11:06 AM.

              Comment


              • #8
                Would you please post it to a URL so I can look at it from Mozilla?
                "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
                June 30, 2001
                author, ES-Membrane project (Github Pages site)
                author, Verbosio prototype XML Editor
                author, JavaScript Developer's Dictionary
                https://alexvincent.us/blog

                Comment


                • #9
                  I understand how to create a dtd, but how do I load it from the document? Here's an XHTML 1.0 Strict DTD

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

                  <!DOCTYPE> is the tag,

                  html and public are some valueless attributes which I have no idea what they are for (and xhtml doesn't let you use attributes without values, such as 'border').

                  The first thing in quotation marks:
                  "-//W3C//DTD XHTML 1.0 Strict//EN"
                  Maybe that's just a meaningless thing. Makes no sense to me.

                  And lastly:
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
                  This is the one part that makes sense.


                  So to load my own doctype do I simply make an xml file such as


                  <?xml version="1.0" encoding="ISO-8859-1"?>
                  <!DOCTYPE "fiile.dtd">
                  <testdata>
                  <x value="Tails" />
                  </testdata>


                  and the dtd would contain


                  <!ELEMENT testdata (x?)>
                  <!ELEMENT x (#CDATA)>
                  <!ATTLIST x value CDATA "">


                  Is this correct? I know there are validators for the rules of XML (all tags must end, etc) but is there a way to validate an XML file according to it's doctype? How exactly are you supposed to load a dtd and what's the XHTML doctype attributes mean?
                  Go to:
                  http://www.TailsArchive.net/
                  http://xfox.proboards21.com/

                  Comment


                  • #10
                    Well, let's get on explaining. In XML there are three kinds of tags:
                    - Elements <elementname attributes>, which may be empty or containers.
                    - Parser Commands <!parsercommand> of multiple types, that have a special structure I will come back to.
                    - PIs (Processing Instructions) <?PI?> that you may use for telling the XML parser to call other external content processors.

                    Then there is a special case - the XML prolog - which despite it's looks is not a PI, nor it is any of the others.

                    The element structure you know. The XML prolog you know. Other PIs you probably have an idea about. The parser command structure may be new to you, however.



                    {Now, I'm not exactly sure which additional limits XML puts that SGML didn't put on these things, so I might be generalising too much for XML here. Anyway, I'll try to explain it without it ending in essay size...}

                    All in all, the parser command structure is a general groupd for very many constructs. Inside it you may have three general structures:
                    - A comment (in XML only a single one, though SGML allowed more than one), starting and ending with a double hyphen. <!-- E.g. this parser command containing a single comment -->
                    - A block structure, starting in left brace followed by a descriptor followed by another left brace, ending in two right braces. <![CDATA[ E.g. this parser command containing a single CDATA block ]]>
                    - If the parser command does not start in a comment or a container, the first part must be a descriptor, like DOCTYPE, ELEMENT, ATTLIST, ENTITY, or NOTATION. Each of these have it's own structure for the parts following.


                    The doctype follows this structure:
                    - DOCTYPE
                    - rootelement
                    - identifier (which may follow either of the following syntaces)
                    &nbsp;&nbsp;&nbsp;> PUBLIC officialname dtduri
                    &nbsp;&nbsp;&nbsp;> SYSTEM dtduri
                    - internal subset (a DTD or part of a DTD, enclosed with braces)

                    E.g <!DOCTYPE root PUBLIC "-//Source//Name and Version//Language" "http://example.net/example.dtd" [
                    &nbsp;&nbsp;&nbsp;<!-- A comment within the doctype -->
                    &nbsp;&nbsp;&nbsp;<!ELEMENT root EMPTY>
                    ]>
                    Last edited by liorean; Feb 25, 2004, 07:29 PM.
                    liorean <[[email protected]]>
                    Articles: RegEx evolt wsabstract , Named Arguments
                    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
                    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

                    Comment

                    Working...
                    X