DOCTYPE

Discussion in 'XML' started by Hugo, Nov 10, 2007.

  1. Hugo

    Hugo Guest

    Hi,

    I have the following XML file

    <!DOCTYPE xqsn>
    <xqsn version="1.0" >
    <p name="BB" >
    <a>CK</a>
    <pa>1</pa>
    <b></b>
    <d>1995</d>
    </p>
    </xqsn>

    It is soley defined for my own application to store configuration data. I've
    decided to name my DOCTYPE xqsn. The question is, is there any standard I
    should use as DOCTYPE? Should I use DOCTYPE at all if it is just for a
    single application but not a "open standard"? What is the DOCTYPE for?

    Thanks!
     
    Hugo, Nov 10, 2007
    #1
    1. Advertising

  2. Hugo wrote:

    > <!DOCTYPE xqsn>
    > <xqsn version="1.0" >
    > <p name="BB" >
    > <a>CK</a>
    > <pa>1</pa>
    > <b></b>
    > <d>1995</d>
    > </p>
    > </xqsn>
    >
    > It is soley defined for my own application to store configuration data. I've
    > decided to name my DOCTYPE xqsn. The question is, is there any standard I
    > should use as DOCTYPE? Should I use DOCTYPE at all if it is just for a
    > single application but not a "open standard"? What is the DOCTYPE for?


    You need to use the name of the root element so in your case xqsn. On
    the other hand putting only <!DOCTYPE xqsn> in the document does not
    make much sense, you need to add element and attribute declarations.
    Otherwise you can simply drop the DOCTYPE node.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Nov 10, 2007
    #2
    1. Advertising

  3. Hugo

    Hugo Guest

    Martin Honnen wrote:

    > Hugo wrote:
    >
    >> <!DOCTYPE xqsn>
    >> <xqsn version="1.0" >
    >> <p name="BB" >
    >> <a>CK</a>
    >> <pa>1</pa>
    >> <b></b>
    >> <d>1995</d>
    >> </p>
    >> </xqsn>
    >>
    >> It is soley defined for my own application to store configuration data.
    >> I've decided to name my DOCTYPE xqsn. The question is, is there any
    >> standard I should use as DOCTYPE? Should I use DOCTYPE at all if it is
    >> just for a single application but not a "open standard"? What is the
    >> DOCTYPE for?

    >
    > You need to use the name of the root element so in your case xqsn. On
    > the other hand putting only <!DOCTYPE xqsn> in the document does not
    > make much sense, you need to add element and attribute declarations.
    > Otherwise you can simply drop the DOCTYPE node.
    >
    >


    How do these declarations look like?

    Thanks!
     
    Hugo, Nov 10, 2007
    #3
  4. Hugo

    Peyo Guest

    Hugo a écrit :

    >> You need to use the name of the root element so in your case xqsn. On
    >> the other hand putting only <!DOCTYPE xqsn> in the document does not
    >> make much sense, you need to add element and attribute declarations.
    >> Otherwise you can simply drop the DOCTYPE node.

    >
    > How do these declarations look like?


    http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

    p.
     
    Peyo, Nov 11, 2007
    #4
  5. Hugo

    Peter Flynn Guest

    On Sun, 11 Nov 2007 07:17:21 +0800, Hugo wrote:

    > Martin Honnen wrote:
    >
    >> Hugo wrote:
    >>
    >>> <!DOCTYPE xqsn>
    >>> <xqsn version="1.0" >
    >>> <p name="BB" >
    >>> <a>CK</a>
    >>> <pa>1</pa>
    >>> <b></b>
    >>> <d>1995</d>
    >>> </p>
    >>> </xqsn>
    >>>
    >>> It is soley defined for my own application to store configuration
    >>> data. I've decided to name my DOCTYPE xqsn. The question is, is there
    >>> any standard I should use as DOCTYPE? Should I use DOCTYPE at all if
    >>> it is just for a single application but not a "open standard"? What is
    >>> the DOCTYPE for?

    >>
    >> You need to use the name of the root element so in your case xqsn. On
    >> the other hand putting only <!DOCTYPE xqsn> in the document does not
    >> make much sense, you need to add element and attribute declarations.
    >> Otherwise you can simply drop the DOCTYPE node.
    >>
    >>
    >>

    > How do these declarations look like?


    <?xml version="1.0"?>
    <!DOCTYPE xqsn [
    <!ELEMENT xqsn (p+)>
    <!ATTLIST xqsn version CDATA #FIXED "1.0">
    <!ELEMENT p (a,pa,b,d)>
    <!ATTLIST p name CDATA #REQUIRED>
    <!ELEMENT a (#PCDATA)>
    <!ELEMENT pa (#PCDATA)>
    <!ELEMENT b (#PCDATA)>
    <!ELEMENT d (#PCDATA)>
    ]>
    <xqsn version="1.0" >
    <p name="BB" >
    <a>CK</a>
    <pa>1</pa>
    <b></b>
    <d>1995</d>
    </p>
    </xqsn>

    Except that you haven't told us anything about whether xqsn can contain
    other stuff apart from p, or if p can contain other stuff than what you
    showed us...so the above is just a "best-guess" at your data model.

    The objective of a DTD is to guide the creation of the documents, so that
    all documents of type xqsn follow the same pattern. Assuming you are
    going to want to create more than one document, it may be better to put
    the DTD into a separate file, eg

    ----------- myxsqn.dtd ------------------------
    <!ELEMENT xqsn (p+)>
    <!ATTLIST xqsn version CDATA #FIXED "1.0">
    <!ELEMENT p (a,pa,b,d)>
    <!ATTLIST p name CDATA #REQUIRED>
    <!ELEMENT a (#PCDATA)>
    <!ELEMENT pa (#PCDATA)>
    <!ELEMENT b (#PCDATA)>
    <!ELEMENT d (#PCDATA)>
    ----------------------------------------------

    and then each document says

    <?xml version="1.0"?>
    <!DOCTYPE xqsn SYSTEM "myxqsn.dtd">
    <xqsn version="1.0" >
    <p name="BB" >
    <a>CK</a>
    <pa>1</pa>
    <b></b>
    <d>1995</d>
    </p>
    </xqsn>

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
     
    Peter Flynn, Nov 11, 2007
    #5
    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. Ian

    vs.net creates doctype wrong?

    Ian, Jun 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    502
  2. Kenneth Keeley

    Setting DocType in Asp.Net

    Kenneth Keeley, Jun 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    649
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jun 30, 2004
  3. Neil Zanella
    Replies:
    3
    Views:
    2,604
    John Saunders
    Jan 4, 2005
  4. Jake

    Changing DOCTYPE in template

    Jake, Aug 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    405
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,359
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page