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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:01:59+00:00 2026-05-13T22:01:59+00:00

Is there any PHP script to convert XML file to DTD. I tried a

  • 0

Is there any PHP script to convert XML file to DTD.

I tried a lot. I can able to find tools but can’t PHP script.

Is there any?

any help will be thankful…

Fero

  • 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-13T22:01:59+00:00Added an answer on May 13, 2026 at 10:01 pm

    Generating a DTD from an XML file is something I’ve not seen done quite often — one of the main reasons being that you cannot be sure the XML file you used to generate the DTD will contain everything that the DTD should define.

    i.e. the generated DTD will only contain the elements and attributes that were present in that specific XML file — which doesn’t necessarily means all elements and attributes that should be accepted when using it later.

    That being said, I haven’t found any PHP tool to create a DTD from an XML file…

    … But I’ve found a JAVA one : DTDGenerator – A tool to generate XML DTDs (quoting) :

    DTDGenerator is a program that takes
    an XML document as input and produces
    a Document Type Definition (DTD) as
    output
    .

    The aim of the program is to give you
    a quick start in writing a DTD.
    The
    DTD is one of the many possible DTDs
    to which the input document conforms.

    Typically you will want to examine the
    DTD and edit it to describe your
    intended documents more precisely.

    A couple of nice things about this DTDGenerator program are :

    • There are some explanations on the website about the basic ideas of how this works
    • The source code is provided
    • It’s only less that 600 lines long
      • which means one should be able to understand without too much efforts
      • and possibly port it to PHP ?
      • And there are some comments in the source code — which would help.
    • It’s published under MPL — which means open source ; which is good, if you want to port it

    Starting from that program’s source code, it should be possible to write some PHP code (if you cannot execute JAVA, and really need this to be written in PHP) to do the same thing : the basic ideas are not that hard :

    • You have to go through the XML structure
    • building a tree-representation of it, on each starting tag
      • which means elements
      • that can have attributes
    • And, when you’ve finished going through the XML document, you have to build the DTD from your reprensentation of the document
      • That might be the hard part — looking at the source of the JAVA tool I linked to, it reprensents quite a large number of lines of code ^^

    Nice thing of taking a look at this DTDGenerator before starting is that its author already thought about this process — and already identified some situations that you might not think about 😉

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

Sidebar

Ask A Question

Stats

  • Questions 393k
  • Answers 393k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think this should return what you are after: $obj->getNode()->getAncestors();… May 15, 2026 at 2:05 am
  • Editorial Team
    Editorial Team added an answer I think the question might be phrased better the other… May 15, 2026 at 2:05 am
  • Editorial Team
    Editorial Team added an answer I believe that you need to reference the controls using… May 15, 2026 at 2:05 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.