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

  • SEARCH
  • Home
  • 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 8412555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:42:00+00:00 2026-06-10T00:42:00+00:00

I have query regarding specifying sub-parts of an element while defining a DTD for

  • 0

I have query regarding specifying sub-parts of an element while defining a DTD for XML. I want to have an element titled “Description”, which may have any inter-leaved sequence of a BookRef and PCDATA. I’m using following statement in my XML DTD.

<!ELEMENT Description (#PCDATA|Courseref)* >

However, I want to enforce a more strict constraint than *. I want to use +, which should mandate the having of at least one PCDATA or Courseref. However, when I use + instead of *, I get a parse error using xmllint.

I’m new to DTD and I want to know, if it is illegal as per XML DTD Specs to specify a + operator.

  • 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-06-10T00:42:01+00:00Added an answer on June 10, 2026 at 12:42 am

    Yes, the XML spec requires that content models of the form

    (#PCDATA | foo | bar | baz)*
    

    list #PCDATA first and use * not + (or anything else) as the occurrence indicator (http://www.w3.org/TR/xml/#NT-Mixed).

    A lot of design considerations played into this, most of them now of purely historical importance. One, however, may be worth noticing: if + were allowed and you did write

    <!ELEMENT Description (#PCDATA|Courseref)+ >
    

    the element declaration would define precisely the same set of valid element instances as the form using *: the token #PCDATA matches zero or more characters of parsed character data, so an element instance like <Description/> would be valid against either form of the element declaration (the zero-length string matches the content-model token #PCDATA once, so the requirement that a +-marked choice be satisfied at least once would be met).

    You might convey your intent here by making Description contain

    (p+ | Courseref)
    

    and saying in the documentation that empty p (paragraph) elements are frowned upon. But DTDs do not provide a way of requiring that there be any minimum length content for a #PCDATA string. That’s one reason some people prefer to use XSD, or Schematron, or Relax NG.

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

Sidebar

Related Questions

I have a query regarding showing a video (which is stored on server) on
I have a query regarding to find out which is day (in given list)
I have been having a query regarding writing unit tests for web methods which
I have a problem regarding a query where i want to only display data
I have a query regarding update progress panel. I want to fit update progress
I want to process audio offline on iOS, but have a query regarding memory
I have a query regarding creating a Immutable class. Following are the points which
I have a query regarding Music Files. I want to select 1/more Music files
I have a query regarding the directory returned from Path.GetTempPath() function. It returns C:\Documents
I have a query regarding PLSQL exceptions and how to handle them in Java

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.