Jun 7, 2011, 9:15 AM
Post #1 of 7
Here's a DTD I have but I've been having some trouble parsing it and generating a hash in Perl from it. I want to parse a xml document with the below layout and end up having a hash with the data stored. The xml document is essentially a tree of data, some branches longer than others and varying number of child nodes.
Algorithm in Perl
The end hash should consist of a hash hierarchy of only the values from the "id" elements. blockInfo contains information about the current treeTop item. So a treeTop item has an id instead of blockInfo that is unique and a treeTop item can contain more treeTop items, or in this case I guess you can call branches.
Any help would be appreciated. Thanks.
<!DOCTYPE TREELAYOUT [
<!ELEMENT treeMap (treeTop*)>
<!ELEMENT treeTop (blockInfo, treeTop*)>
<!ELEMENT blockInfo (id, name, description, field1)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT field1 (#PCDATA)> ]>
(This post was edited by AggressiveFish on Jun 7, 2011, 9:21 AM)