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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:29:29+00:00 2026-05-30T10:29:29+00:00

How would I know if The XML that I created follows the rule that

  • 0

How would I know if The XML that I created follows the rule that is in my DTD?

here’s my XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE HW SYSTEM "HW.dtd">
<A>
    AA = "BAR"
    AB = "FOO"
    AC = "1"
    <C>
        <B/>
        CA = "Name"
    </C>
    <D>Element</D>
</A>

and here is my DTD

<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT A (B* |C+,D)>
<ATTLIST A
    AA CDATA #REQUIRED
    AB CDATA #REQUIRED
    AC(0|1|2) #REQUIRED
>
<!ELEMENT B EMPTY>
<!ATTLIST C(B)>
<!ATTLIST C
    CA CDATA #REQUIRED
>
<!ELEMENT D (#PCDATA)>

is my XML correct with the DTD?

  • 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-30T10:29:30+00:00Added an answer on May 30, 2026 at 10:29 am

    You need to Use an XML Validator,

    An Online version is http://www.xmlvalidation.com/, there are lots of tools that do this also

    According to the validator, your DTD is not valid

    I’ve tried to fix up your DTD, here’s the fixed up version

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!ELEMENT A (B* | (C+,D))>
    <!ATTLIST A
        AA CDATA #REQUIRED
        AB CDATA #REQUIRED
        AC (0|1|2) #REQUIRED
    >
    <!ELEMENT B EMPTY>
    <!ELEMENT C EMPTY>
    <!ATTLIST C
        CA CDATA #REQUIRED
    >
    <!ELEMENT D (#PCDATA)>
    

    The problems with the DTD you posted were:

    As far as I could see you need the brackets around C+,D also the <ATTLIST above is incorrect as you specify a list of attributes with <!ATTLIST note the ! was missing.

    Also your DTD had

    <!ELEMENT B EMPTY>
    <!ATTLIST C
        CA CDATA #REQUIRED
    >
    

    Which failed validation as you were defining an attribute list from element C <!ATTLIST C but hadn’t defined the Element C in the DTD, therefore I changed it to

    <!ELEMENT C EMPTY>
    <!ATTLIST C
        CA CDATA #REQUIRED
    >
    

    This makes your DTD valid

    Also your XML is wrong in quite a few ways

    for example your DTD specifices

    <!ATTLIST A
        AA CDATA #REQUIRED
        AB CDATA #REQUIRED
        AC (0|1|2) #REQUIRED
    >
    

    Which means that Element A must have the attributes AA BB AC as they are required also AC attribute must be 0 or 1 or 2

    You have put

    <A>
        AA = "BAR"
        AB = "FOO"
        AC = "1"
    

    Which is not specifiying XML attributes in the Element A, to specify attributes it should be

    <A AA="BAR" AB="FOO" AC="1">
    

    This should help you do your homework

    heres a link http://www.quackit.com/xml/tutorial/dtd_introduction.cfm to a DTD tutorial this should help you create an XML doc that validates against it

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

Sidebar

Related Questions

I would like to know if there are any xml coding standards. <?xml version=1.0?>
I created a Stored Procedure that returns XML and I would like to also
I know that JMS Queues can be created in HornetQ via the hornetq-jmx.xml Configuration
I would like to know a way to create an XML file using MySQL
I converted my whole site to XML/XSL and I would like to know all
i would to know if somebody knows a methodology or whatever that be capable
I have a object that is created through deserialization of some XML. I used
I would know if it is possible to create a ListView with a fixed
I would know if there is the possibility to create a new Android Activity
Would anyone know how to test for the appearance of a Toast message on

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.