Hidden.text inside emphasis tag

Discussion in 'XML' started by Sue, Jan 29, 2010.

  1. Sue

    Sue Guest

    I am trying to use <emphasis> tag to encapsulate the target word/
    phrase and the <hidden.text> element to encapsulate the definition
    with the <hidden.text> element contained within the <emphasis>
    element.
    This requires a structural change to the DTD. So We have defined this
    in DTD as :
    <!ELEMENT emphasis (#PCDATA, hidden.text?, #PCDATA)>
    DTD validation fails in this case because of the 2nd occurrence of
    #PCDATA.
    If I change the DTD structure to:
    <!ELEMENT emphasis (text1, hidden.text?, text2)>
    <!ELEMENT text1 (#PCDATA)>
    <!ELEMENT text2 (#PCDATA)>
    This means that I need to have additional 2 tags for text1 and text2
    in the XML file to make the XML valid.

    Can anyone of you think of any other solution to this problem?
    Sue, Jan 29, 2010
    #1
    1. Advertising

  2. > Can anyone of you think of any other solution to this problem?

    Go with mixed content. It won't let you constrain order or frequency of
    the content, but it will let you mix text and structure.

    http://www.w3.org/TR/REC-xml/#sec-mixed-content

    In this case,
    <!ELEMENT emphasis (#PCDATA|hidden.text)* >

    If you want to constrain things more tightly than that, DTDs do require
    that you introduce additional levels of structure. The alternative is to
    switch from DTDs to XML Schemas (http://www.w3.org/XML/Schema), assuming
    your tools will support them. (Most should, these days.) Schemas take
    some getting used to, but they're a more powerful constraint and typing
    system, and unlike DTDs they support XML Namespaces properly.

    Or you can leave it loose at the validation level and impose additional
    structural constraints in the application code. DTDs or Schemas aren't
    intended to completely define the structure of the markup language;
    they're just "higher-level syntax checking". The semantic rules almost
    always wind up having to be imposed by the applications.

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jan 30, 2010
    #2
    1. Advertising

  3. Sue

    Sue Guest

    On Jan 29, 10:15 pm, Joe Kesselman <>
    wrote:
    > > Can anyone of you think of any other solution to this problem?

    >
    > Go with mixed content. It won't let you constrain order or frequency of
    > the content, but it will let you mix text and structure.
    >
    > http://www.w3.org/TR/REC-xml/#sec-mixed-content
    >
    > In this case,
    > <!ELEMENT emphasis (#PCDATA|hidden.text)* >
    >
    > If you want to constrain things more tightly than that, DTDs do require
    > that you introduce additional levels of structure. The alternative is to
    > switch from DTDs to XML Schemas (http://www.w3.org/XML/Schema), assuming
    > your tools will support them. (Most should, these days.) Schemas take
    > some getting used to, but they're a more powerful constraint and typing
    > system, and unlike DTDs they support XML Namespaces properly.
    >
    > Or you can leave it loose at the validation level and impose additional
    > structural constraints in the application code. DTDs or Schemas aren't
    > intended to completely define the structure of the markup language;
    > they're just "higher-level syntax checking". The semantic rules almost
    > always wind up having to be imposed by the applications.
    >
    > --
    > Joe Kesselman,http://www.love-song-productions.com/people/keshlam/index.html
    >
    > {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    > /\ Stamp out HTML mail!  | "Put down the squeezebox & nobody gets hurt."


    Thanks Joe.
    I think <!ELEMENT emphasis (#PCDATA|hidden.text)* > is the best
    option for me.
    Regards,
    Sue
    Sue, Feb 2, 2010
    #3
    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. kishan bisht

    struts tag inside a tag

    kishan bisht, Jul 8, 2003, in forum: Java
    Replies:
    1
    Views:
    1,477
    Wendy S
    Jul 9, 2003
  2. shruds
    Replies:
    1
    Views:
    757
    John C. Bollinger
    Jan 27, 2006
  3. Replies:
    66
    Views:
    1,066
    Paul Rubin
    Feb 5, 2007
  4. Replies:
    20
    Views:
    578
    Richard Bos
    Jul 17, 2006
  5. SolarCanine
    Replies:
    2
    Views:
    253
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page