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 4563006
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:17:48+00:00 2026-05-21T18:17:48+00:00

I am just learning to write XML and associated DTD’s, and I’m wondering if

  • 0

I am just learning to write XML and associated DTD’s, and I’m wondering if I can combine certain things in one line of an !ATTLIST.

eg:

I have an element weight, and I want to have (kg|lb) as options, but set "kg" as the default. None of these are essential, so the status is #IMPLIED, but I also want to have a default weight of “1”.

Can I legally put all this in one line:

<!ELEMENT weight (#PCDATA)>
<!ATTLIST weight unit CDATA "1" (kg|lb) "kg" #IMPLIED>

Or can I do it this way:

<!ELEMENT weight (#PCDATA)>
<!ATTLIST weight unit CDATA>
<!ATTLIST weight unit "1" #IMPLIED>
<!ATTLIST weight unit (kg|lb)>
<!ATTLIST weight unit "kg" #IMPLIED>

I suspect there are problems with both, and I am a little confused as to how I combine these features (or if I even can) – so I would really appreciate a little guidance on doing this properly.

  • 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-21T18:17:49+00:00Added an answer on May 21, 2026 at 6:17 pm

    Ok, I have got it working by doing the following, although it might not be the ‘accepted practice’ way:

    <!ELEMENT weight (#PCDATA)>
    <!ATTLIST weight qty  CDATA "1">
    <!ATTLIST weight unit CDATA (kg|lb) "kg">
    

    I had to break the value out into its own attribute (which makes sense now I think about it), and remove the #IMPLIED, since I read somewhere that by setting a default value, its implied anyway.

    Hopefully this will help someone else (assuming its the right way to do it)

    Cheers

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

Sidebar

Related Questions

I have just started learning to write apps for android using Eclipse. Where can
Just started learning NHiberate. It seems rather tedious to write proper hbm.xml config files
I just start learning to write web services yesterday, kinda fascinating. I created an
Im just learning SQLite and I can't get my parameters to compile into the
I'm just learning jQuery, and I'm trying to write a little script. To sum
While I was learning about how to write an XHTML document with XML writer
I am just learning how to write mutithreaded programs right now and I have
I am just learning socket programming and I am trying to write an echo
I just started learning to write iPhone app (maybe a little too late) from
I'm just learning Haskell and I am trying to write some code that simply

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.