Extend xhtml1.0 with custom elements

Discussion in 'XML' started by __PPS__, Sep 7, 2005.

  1. __PPS__

    __PPS__ Guest

    Hello, I'm newbe to xml/dtd (and probably I don't use all the termins
    correctly). I'm writing an application that parses xhtml file with
    custom elements and splits it into 2 parts - valid xhtml1.0 and a
    script file.
    basicly I have this:
    ....
    <MYML:form action="">
    <MYML:input type="text"> ... ...
    </MYML:form>
    ....
    then my parser searches for MYML:form transforms it to xhtml1:
    <form action="">
    <input type="text"> ... ...
    </form>
    and produces script that handles submition of this form.

    I'm using xerces validating parser (is it a good choice?) and I want to
    write a module to extend xhtml_1.0 dtd to include my custom element. I
    read w3.ord TRs (Modularization of XHTML, w3schools tutorials and
    others) but I still have some trouble.
    My goal is to make sure that MYML dtd is superset of xhtml_1.0 - any
    valid xhtml1 is also valid MYML document (when I followed examples on
    the w3.org site I always have some troble - somtimes valid xhtml docs
    don't validate against MYML dtd. For instance, I have problems with
    <script ...> tag - it doesn't seem to be recognized anymore). The
    second thing is that I want to make sure that my new MYML:form element
    may appear only where XHTML:form element may appear and (if that's
    possible) MYML:form could include HTML:input or MYML:input and so on
    for other form elements (when a form element is used with MYML prefix
    then there will be some extra code generated for this element). MYML
    form elements (such as MYML:input) should have all the attributes from
    the usual input element plus some extra MYML.attribs
    It should be modular - I want to be able to make custom dtd's for all
    xhtml1.0 dtd's (strict, transitional, frameset). From the beginning I
    downloaded xhtml1-strict.dtd and tried to edit it to add the extra
    attributes, then I would have to repeat the same task with other dtd's.
    I gave up this aproach when I googled to Modularization of XHTML, which
    seem to be a better solution.


    If someone on this group knows something about
    dtd/extending/modularization, please help me with this task (by an
    advice, or a link to a good source on this subject)

    Thank you
     
    __PPS__, Sep 7, 2005
    #1
    1. Advertising

  2. __PPS__ wrote:


    > <MYML:form action="">
    > <MYML:input type="text"> ... ...
    > </MYML:form>


    One thing is for sure, writing DTDs for XML with namespaces is a tedious
    thing, if I had the choice I would opt to use XSD schemas instead of
    DTDs. That assumes that MYML:form is supposed to be a qualified name and
    you want to have those elements in your own namespace.


    > If someone on this group knows something about
    > dtd/extending/modularization, please help me with this task (by an
    > advice, or a link to a good source on this subject)


    The XHTML 1.0 DTDs are not easy to use for modularization, as you have
    already found the W3C later, after XHTML 1.0 has laid the foundation for
    modularization with
    <http://www.w3.org/TR/xhtml-modularization>
    so take that as a start and then look at
    <http://www.w3.org/TR/xhtml11>
    which makes use of that.
    XHTML Basic <http://www.w3.org/TR/xhtml-basic> is also an example.

    But in the end you want more than using the defined modules, you want to
    have your own module and mix that, an example of that is MathML as a DTD
    module:
    <http://www.w3.org/TR/MathML2/appendixa.html#parsing.module>
    There is also a working draft mixing XHTML, MathML and SVG:
    <http://www.w3.org/TR/XHTMLplusMathMLplusSVG>

    There is also this tutorial:
    <http://www.w3.org/MarkUp/Guide/xhtml-m12n-tutorial/>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Sep 7, 2005
    #2
    1. Advertising

  3. __PPS__

    __PPS__ Guest

    Martin Honnen wrote:
    > One thing is for sure, writing DTDs for XML with namespaces is a tedious
    > thing, if I had the choice I would opt to use XSD schemas instead of
    > DTDs. That assumes that MYML:form is supposed to be a qualified name and
    > you want to have those elements in your own namespace.


    Yes, I need my own namespace, however, it doesn't seem to be difficult
    to implement with dtd. I chose dtd over xsd because xhtml1.0 is defined
    by dtd

    > The XHTML 1.0 DTDs are not easy to use for modularization, as you have
    > already found the W3C later, after XHTML 1.0 has laid the foundation for
    > modularization with
    > <http://www.w3.org/TR/xhtml-modularization>
    > so take that as a start and then look at
    > <http://www.w3.org/TR/xhtml11>
    > which makes use of that.
    > XHTML Basic <http://www.w3.org/TR/xhtml-basic> is also an example.


    I looked these docs, thanks. But the problem is that my resultin
    document should be xhtml 1.0 (after transformation) but xhtml11 is more
    strict. That means that some xhtml1.0 valid docs will not be valid for
    my new MyML dtd (as it's going to be xhtml11 base). Am I right about
    that?


    One other thing - I read alot of tutorials - all of them describe how
    to define <!ELEMENT ...> <!ATTRLIST ...> or whatever, but I never saw
    anything about conditions as I saw inside some of the dtd's:
    <![%MyML.prefixed;[
    <!ENTITY % MyML.pfx "%MyML.prefix;:" >
    ]]>
    <!ENTITY % MyML.pfx "" >

    Where I could read about complete syntax for dtd (all those <!ENTETY
    with '%' sign, vs <!ENTETY without '%' sign) etc... I still don't
    understand a lot from the standard dtd's

    thanks
     
    __PPS__, Sep 7, 2005
    #3
  4. __PPS__

    __PPS__ Guest

    ok, I found where syntax for dtd's s defined - xml specs define it.
     
    __PPS__, Sep 7, 2005
    #4
    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. CJ
    Replies:
    10
    Views:
    619
  2. Andreas Prilop

    Re: XHTML1.0 validation problem

    Andreas Prilop, Aug 30, 2003, in forum: HTML
    Replies:
    3
    Views:
    359
  3. CJ
    Replies:
    4
    Views:
    493
  4. Replies:
    1
    Views:
    335
    Uche Ogbuji
    Aug 9, 2004
  5. Rob Meade

    XHTML1-Transitional / Font size...

    Rob Meade, Nov 22, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    493
    Rob Meade
    Nov 23, 2006
Loading...

Share This Page