Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6971479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:50:43+00:00 2026-05-27T16:50:43+00:00

In a DTD file, how do I declare that an element must have an

  • 0

In a DTD file, how do I declare that an element must have an attribute.
This attribute must be one of the following three: si, sl or ii

<bla si="foo">
<bla ii="foo">
<bla sl="foo">

are valid, and:

<bla> or
<bla somthing="foo"> or
<bla si="foo" ii="bar">

should all be not valid

thanks in advance

Edit:

this doesn’t do the trick, but it is close:

<!ATTLIST bla si CDATA #REQUIRED
                sl CDATA #REQUIRED
                ii CDATA #REQUIRED
 >

it requires all of the attributes to be there, but I want to force, that only one of the attributes is there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:50:43+00:00Added an answer on May 27, 2026 at 4:50 pm

    In DTD Attributes cannot be interdependent. You can use #REQUIRED or #IMPLIED to make any of the attributes mandatory or optional, but you can’t otherwise force the number of attributes that must be present.

    Generally a good design practice is to use attributes only to itemize the features of the element, not to change the meaning of the element, and keep to the attributes independent of each other. If these are your goals, consider making them (alternate) child elements or providing alternate versions of your “host” element so that they can for example have different attribute sets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file that looks like this: <!DOCTYPE ROOT SYSTEM zombie.dtd> <ROOT>
i have a DTD file which i used to accessed through this link: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
I have this xml file: data_out.xml <?xml version=1.0 ?> <!DOCTYPE allproperty SYSTEM data_out.dtd> <allproperty>
Can I have a dtd file check that the values of numbers are between
I have a XHTML-file using the following doctype-definition: `<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
How can I validate an XML file against a DTD that is stored locally
I have a DTD and I would like to limit a few attribute properties'
I have following xml file: <?xml version = "1.0" ?> <Employee> <Emp_Id>E-001</Emp_Id> <Emp_Name>Vinod</Emp_Name> <Emp_E-mail>Vinod1@yahoo.com</Emp_E-mail>
I have two XML files located in res/xml/. One file is a normal XML
i have a config file xml <tflow name=CENTRE inputDTD=/JOBS/cnav/etc/jobReporting/batch/dtd/dtd-ContactCentre.dtd inputFile=/JOBS/cnav/etc/jobReporting/import/2010.05.02.CONTACTCENTRE.xml logPath=/JOBS/cnav/etc/jobReporting/logs/ rejectPath=/JOBS/cnav/etc/jobReporting/rejets//> <tflow name=SKILL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.