Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Hidden.text inside emphasis tag

Reply
Thread Tools

Hidden.text inside emphasis tag

 
 
Sue
Guest
Posts: n/a
 
      01-29-2010
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?
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      01-30-2010
> 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...lam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
 
Reply With Quote
 
 
 
 
Sue
Guest
Posts: n/a
 
      02-02-2010
On Jan 29, 10:15*pm, Joe Kesselman <(E-Mail Removed)>
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...lam/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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why less emphasis on private data? time.swift@gmail.com Python 66 02-05-2007 03:54 PM
Looking for a C textbook with emphasis on data types ilya2@rcn.com C Programming 20 07-17-2006 06:51 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Why so much emphasis on Auto-Focus? John A. Stovall Digital Photography 81 01-19-2005 01:29 AM
How to upgrade mcse 2000 to mcse 2003 with security emphasis cathedral_sg@hotmail.com MCSE 3 02-17-2004 04:53 PM



Advertisments