Нет функции dtdParse.
dtdparse - это программа, поставляемая с модулем SGML :: DTDParse.
Вы можете использовать ее для выгрузки xml из файла dtd.Быстрый пример того, как вы могли бы использовать dtdparse:
use strict;
use warnings;
use SGML::DTDParse;
use XML::Simple;
use Data::Dumper;
# Convert the DTD file to XML
my $result = qx{dtdparse test.dtd};
# Create the XML object
my $xml = new XML::Simple;
# Read the XML file
$result = $xml->XMLin($result);
# print the output
$Data::Dumper::Indent = 1;
print Dumper($result);
, где test.dtd выглядит так:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT DatabaseInventory (DatabaseName+)>
<!ELEMENT DatabaseName ( GlobalDatabaseName
, OracleSID
, DatabaseDomain
, Administrator+
, DatabaseAttributes
, Comments)
>
<!ELEMENT GlobalDatabaseName (#PCDATA)>
<!ELEMENT OracleSID (#PCDATA)>
<!ELEMENT DatabaseDomain (#PCDATA)>
<!ELEMENT Administrator (#PCDATA)>
<!ELEMENT DatabaseAttributes EMPTY>
<!ELEMENT Comments (#PCDATA)>
<!ATTLIST Administrator EmailAlias CDATA #REQUIRED>
<!ATTLIST Administrator Extension CDATA #IMPLIED>
<!ATTLIST DatabaseAttributes Type (Production|Development|Testing) #REQUIRED>
<!ATTLIST DatabaseAttributes Version (7|8|8i|9i) "9i">
<!ENTITY AUTHOR "Jeffrey Hunter">
<!ENTITY WEB "www.iDevelopment.info">
<!ENTITY EMAIL "jhunter@iDevelopment.info">
, который выдаст что-то вроде этого:
$VAR1 = {
'namecase-entity' => '0',
'created-by' => 'DTDParse V2.00',
'public-id' => '',
'version' => '1.0',
'attlist' => {
'DatabaseAttributes' => {
'attribute' => {
'Type' => {
'value' => 'Production Development Testing',
'type' => '#REQUIRED',
'default' => '',
'enumeration' => 'yes'
},
'Version' => {
'value' => '7 8 8i 9i',
'type' => '',
'default' => '9i',
'enumeration' => 'yes'
}
},
'attdecl' => ' Type (Production|Development|Testing) #REQUIRED'
},
'Administrator' => {
'attribute' => {
'EmailAlias' => {
'value' => 'CDATA',
'type' => '#REQUIRED',
'default' => ''
},
'Extension' => {
'value' => 'CDATA',
'type' => '#IMPLIED',
'default' => ''
}
},
'attdecl' => ' EmailAlias CDATA #REQUIRED'
}
},
'element' => {
'OracleSID' => {
'content-type' => 'mixed',
'content-model-expanded' => {
'sequence-group' => {
'pcdata' => {}
}
},
'content-model' => {
'sequence-group' => {
'pcdata' => {}
}
}
},
'Comments' => {
'content-type' => 'mixed',
'content-model-expanded' => {
'sequence-group' => {
'pcdata' => {}
}
},
'content-model' => {
'sequence-group' => {
'pcdata' => {}
}
}
},
'DatabaseAttributes' => {
'content-type' => 'element',
'content-model-expanded' => {
'empty' => {}
},
'content-model' => {
'empty' => {}
}
},
'GlobalDatabaseName' => {
'content-type' => 'mixed',
'content-model-expanded' => {
'sequence-group' => {
'pcdata' => {}
}
},
'content-model' => {
'sequence-group' => {
'pcdata' => {}
}
}
},
'Administrator' => {
'content-type' => 'mixed',
'content-model-expanded' => {
'sequence-group' => {
'pcdata' => {}
}
},
'content-model' => {
'sequence-group' => {
'pcdata' => {}
}
}
},
'DatabaseInventory' => {
'content-type' => 'element',
'content-model-expanded' => {
'sequence-group' => {
'element-name' => {
'occurrence' => '+',
'name' => 'DatabaseName'
}
}
},
'content-model' => {
'sequence-group' => {
'element-name' => {
'occurrence' => '+',
'name' => 'DatabaseName'
}
}
}
},
'DatabaseDomain' => {
'content-type' => 'mixed',
'content-model-expanded' => {
'sequence-group' => {
'pcdata' => {}
}
},
'content-model' => {
'sequence-group' => {
'pcdata' => {}
}
}
},
'DatabaseName' => {
'content-type' => 'element',
'content-model-expanded' => {
'sequence-group' => {
'element-name' => {
'Comments' => {},
'OracleSID' => {},
'DatabaseAttributes' => {},
'DatabaseDomain' => {},
'GlobalDatabaseName' => {},
'Administrator' => {
'occurrence' => '+'
}
}
}
},
'content-model' => {
'sequence-group' => {
'element-name' => {
'Comments' => {},
'OracleSID' => {},
'DatabaseAttributes' => {},
'DatabaseDomain' => {},
'GlobalDatabaseName' => {},
'Administrator' => {
'occurrence' => '+'
}
}
}
}
}
},
'entity' => {
'WEB' => {
'text-expanded' => 'www.iDevelopment.info',
'text' => 'www.iDevelopment.info',
'type' => 'gen'
},
'AUTHOR' => {
'text-expanded' => 'Jeffrey Hunter',
'text' => 'Jeffrey Hunter',
'type' => 'gen'
},
'EMAIL' => {
'text-expanded' => 'jhunter@iDevelopment.info',
'text' => 'jhunter@iDevelopment.info',
'type' => 'gen'
}
},
'system-id' => 'test.dtd',
'unexpanded' => '1',
'created-on' => 'Tue Feb 28 00:44:52 2012',
'declaration' => '',
'xml' => '0',
'title' => '?untitled?',
'namecase-general' => '1'
};