how would one go about parsing a dtd-file with JS? e.g. converting it to an object for further manipulation. the overall goal is to parse a DTD and visualize it via javascript into a tree structure like this in the browser (e.g. Chrome)
simple DTD for demo purposes (books.dtd)
<!ELEMENT books (book)*>
<!ELEMENT book (front,page,back)>
<!ELEMENT front (#PCDATA)>
<!ELEMENT page (#PCDATA)>
<!ELEMENT back (#PCDATA)>
<!ATTLIST book
isbn ID #REQUIRED
title CDATA #REQUIRED
author CDATA #REQUIRED
>
(source: books.dtd loaded in Treevision Ovidius)
hints in the right direction are much appreciated! I can't find anything or I'm just searching for the wrong things
update: a friend hinted, that another possibility could be to transform the DTD via XSLT to JSON and use the resulting file