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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:13:07+00:00 2026-05-25T11:13:07+00:00

I’d like to know if there exists a program that can read DTD specifications,

  • 0

I’d like to know if there exists a program that can read DTD specifications, use the specifications to create forms or console prompts, use the forms/prompts to obtain user input of data, then write XML documents from the inputted data.

Does there exist such a program?

For example, imagine this:

[begin imagination]

We have the following DTD file to define the structure of an XML document:

<!DOCTYPE cd_collection [
<!ELEMENT cd_collection (album+) >
    <!ELEMENT album (disc+) >
    <!ATTLIST album title CDATA #REQUIRED >
    <!ATTLIST album artist CDATA #REQUIRED >
    <!ATTLIST album label CDATA #REQUIRED >
        <!ELEMENT disc (track*) >
            <!ELEMENT track EMPTY >
            <!ATTLIST track title CDATA #REQUIRED >
            <!ATTLIST track length CDATA #IMPLIED >
            <!ATTLIST track featuring CDATA #IMPLIED >
]>

A program (say a PHP or Javascript website, or a C++ application), reads the DTD file to determine the format of the records that will be kept in an XML file.

After reading the DTD file above, the program will ask for input from the user in order to begin creating an XML tree:

Lets create cd_collection...

What is the title attribute of album 1? Barenaked Ladies Are Men [enter]
What is the artist attribute of album 1? Barenaked Ladies [enter]
What is the label attribute of album 1? Raisin Records [enter]

Does album 1 disc 1 contain track(s) (y/n)? yes [enter]

What is the title attribute of album 1 disc 1 track 1? [enter]
Error: this attribute is required.
What is the title attribute of album 1 disc 1 track 1? Serendipity [enter]
What is the length attribute of album 1 disc 1 track 1 (optional)? 4:11 [enter]
What is the featuring attribute of album 1 disc 1 track 1 (optional)? [enter]

What is the title attribute of album 1 disc 1 track 2? Something You'll Never Find [enter]
What is the length attribute of album 1 disc 1 track 2 (optional)? 4:57 [enter]
What is the featuring attribute of album 1 disc 1 track 2 (optional)? [enter]

...

Does album 1 contain another disc (y/n)? [enter]
Error: Yes or No answer expected.
Does album 1 contain another disc (y/n)? n [enter]

Does cd_collection contain another album (y/n)? yes [enter]

What is the title attribute of album 2? Live From Mars [enter]
What is the artist attribute of album 2? Ben Harper [enter]
What is the label attribute of album 2? Virgin Records [enter]

Does album 1 disc 1 contain track(s) (y/n)? y [enter]

What is the title attribute of album 2 disc 1 track 1? Glory & Consequence [enter]
What is the length attribute of album 2 disc 1 track 1 (optional)? [enter]
What is the featuring attribute of album 2 disc 1 track 1 (optional)? [enter]

...

Does album 2 contain another disc (y/n)? y [enter]

...

What is the title attribute of album 2 disc 2 track 6? The Drugs Don't Work [enter]
What is the length attribute of album 2 disc 2 track 1 (optional)? [enter]
What is the featuring attribute of album 2 disc 2 track 1 (optional)? Richard Ashcroft [enter]

...

Does album 2 contain another disc (y/n)? no [enter]

Does cd_collection contain another album (y/n)? n [enter]

Ok! cd_collection saved in ./cd_collection.xml (or outputted to the screen, etc).

So you see, based on the DTD, the program asks for all pieces of data necessary to create an XML document. The program follows a pattern:

  • It starts at the top of the tree (that the user supposedly has in his
    imagination, a CD Collection in this case) and travels down the tree
    in preorder fashion.
  • Elements labeled with a “+” are required at least once, elements with
    a “*” are required zero or more times, elements with a “?” are
    required zero or one times, and elements with no such label are
    required exactly once. For the purpose of this description, i will
    call these labels “quantity labels”
  • When the program arrives at an element of level X for the first time
    on its way to the end of the first branch of the tree, it does one of
    four things depending on the aforementioned labels: If the element’s
    label is a “+” or nothing, then it is assumed that the element is
    required and moves on to obtain attribute data for the said element
    or moves on to the next element if there are no attribute values to
    prompt for. If the element’s label is “*” or “?”, then the program
    asks the user if such an element exists. If yes, then the program
    creates the element and prompts for attribute values if necessary,
    before moving on. If no, then the program jumps to the next type of
    element at level X if any, or else moves back up the tree to continue
    preorder. If the element at level X is a final element that contains
    #CDATA or #PCDATA (etc), then the program prompts for such data, or
    leaves the element as EMPTY if necessary. Essentially, elements and
    absolute data points are created in preorder.
  • When the program jumps back up the tree to a root of a branch, the
    program analyzes the quantity labels once again. If the root element
    at level X-1 has a label of “+” or “*”, the program asks if more of
    such elements exist (are to be entered, recorded, created, etc). This
    is the mechanism by which the program discovers branches to traverse
    in preorder. Elements at level X-1 who are roots of level-X elements
    that contain a “?” label or nothing are not checked because they can
    only exist in a quantity of at most one, so their presence (or
    non-presence) is already determined as the program traverses down the
    tree (away from root) as described in the previous step.

The program continues like this (with more DTD rules that I may have missed applied as necessary) until it finally gets back to the root element (cd_collection in this case), at which point the program has enough information to write an XML file containing all the aquired datat.

[/end imagination]

In that imaginary scenario, the example was a command line program. However, it could also be a graphical web interface. For example, instead of prompting for data piece by piece like this:

What is the title attribute of album 2? Live From Mars [enter]
What is the artist attribute of album 2? Ben Harper [enter]
What is the label attribute of album 2? Virgin Records [enter]

it could be obtained in an HTML form like this:

album 2:

    title:  ____Live From Mars____
    artist: ____Ben Harper _______
    label:  ____Virgin Records ___

                    [submit button]

Does any such program (or similar program) exist, preferably free? And if so, what is it called and where can I find it?

  • 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-25T11:13:07+00:00Added an answer on May 25, 2026 at 11:13 am

    @trusktr: there is an option to generate HTML form out of DTD in websphere studio. See link

    updated to provide more information:

    Websphere studio is renamed IBM Rational application developer, you can download the trial from here. This IDE is based on eclipse workbench. Do check system requirements before downloading.

    Once installed, it got lot of XML tools/editiors. For your need, you just need to create a DTD using DTD editior by going menu : File > New > Other > XML > DTD
    and once DTD is created, click DTD > Generate HTML Form.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to count the length of a string with PHP. The string
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.