This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Conditional Blocks  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to write conditional blocks in DTD. For Example, the value of Element 1 in block B should be required only if the attribute of Element 1 in block A is "New".
Is there any way to code these kinds of block.
Any other approaches are also welcome.
Thanks,
Raj
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I never came across where conditional coding was done
it a DTD file.
sanjay
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way to alternate DTD declarations are INCLUDE and IGNORE sections:
<![INCLUDE[
some DTD declarations here
]]>

or
<![IGNORE
some DTD declarations here
]]>

Of course, they do not provide functionality you write about.
They do not provide it for two main reasons: first, DTD is a document-oriented validation tool and your task is really data-oriented. XML Schemas are more data-oriented and provide more sharpened validation tools. Yet not as sharp as you want There is another reason for it. Validation is a multi-layered process. Application may want to delegate some part of it to external tools, such as DTD or Schemas, but there always will be some validity constrains application need to check itself.
DTD, Schemas, or any other validating language define formal �grammar� of your data, and they validate data against formal rules. Like English grammar may say something like �if you have a noun in this place, you can put an adjective before, but you cannot have a preceding adverb�. No grammar will tell you: �if you have a noun �programmer�, you can put �smart� before, but adjectives such as �deep� or �colorful� cannot be legally used�. This is not a formal level, this is a semantic level, and, probably, your application should deal with semantic constraints on its own.
Alternatively, if W3C compliance is not a concern, you can use a language which is specially designed to validate schemas instead of defining them � shematron. It utilizes XPath expressions in its rules.

[This message has been edited by Mapraputa Is (edited June 11, 2001).]
 
Raj Sharma
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mapraputa for explaining everything in detail. Really appreciate.
Raj
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!