SGML::DTDParse(3pm)
π NAME π
okay so bestie, meet SGML::DTDParse β the module that parses an SGML or XML DTD. that's it, that's the whole vibe β¨
πΈ SYNOPSIS πΈ
the classic three lines, no notes:
use SGML::DTDParse;
print "This is DTDParse v$SGML::DTDParse::VERSION\n";
π DESCRIPTION π
so the DTDParse collection is literally a whole set of Perl modules and scripts for manipulating SGML and XML Document Type Definitions (DTDs). and like, DTDParse is designed primarily to help you understand and document your DTDs β it's giving "I'm not just a parser, I'm your DTD's biographer" π
here's how you'd typically use this package, step by step:
- Parse the DTD with
dtdparse. this produces an XML representation of the DTD. and the way that this representation exposes both the logical structure of the DTD (the actual meta-structure of its grove) and the organizational structure of the DTD (the declarations and parameter entities) that comprise its textual form? iconic. both. at once. π«Ά - Manipulate the XML document produced by
dtdparseto do whatever you want. DTDParse ships with several programs that demonstrate various capabilities, includingdtdformat, which can produce HTML or DocBook <http://www.oasis-open.org/docbook/> RefEntry pages for each element and parameter entity in the DTD. no cap, it just does that β¨
π¦ DTDParse XML DTD π¦
here's the XML DTD for the XML documents created with dtdparse (also provided in the file etc/dtd.dtd of the DTDParse distribution, iykyk):
<!-- This is the DTD for the documents produced by DTDParse.
The public identifier for this DTD is:
"-//Norman Walsh//DTD DTDParse V2.0//EN"
-->
<!ELEMENT dtd (notation|entity|element|attlist)+>
<!ATTLIST dtd
version CDATA #REQUIRED
unexpanded CDATA #IMPLIED
title CDATA #IMPLIED
namecase-general CDATA #IMPLIED
namecase-entity CDATA #IMPLIED
xml CDATA #IMPLIED
system-id CDATA #IMPLIED
public-id CDATA #IMPLIED
declaration CDATA #IMPLIED
created-by CDATA #IMPLIED
created-on CDATA #IMPLIED
>
<!ELEMENT notation EMPTY>
<!ATTLIST notation
name CDATA #REQUIRED
public CDATA #IMPLIED
system CDATA #IMPLIED
>
<!ELEMENT entity (text-expanded?, text?)>
<!ATTLIST entity
name CDATA #REQUIRED
type CDATA #REQUIRED
notation CDATA #IMPLIED
public CDATA #IMPLIED
system CDATA #IMPLIED
>
<!ELEMENT text (#PCDATA)*>
<!ELEMENT text-expanded (#PCDATA)*>
<!ELEMENT element (content-model-expanded, content-model?,
inclusions?, exclusions?)>
<!ATTLIST element
name CDATA #REQUIRED
stagm CDATA #IMPLIED
etagm CDATA #IMPLIED
content-type (element|mixed|cdata|empty|rcdata) #IMPLIED
>
<!ENTITY % cm.mix "sequence-group|or-group|and-group
|element-name|parament-name
|pcdata|cdata|rcdata|empty">
<!ELEMENT content-model-expanded (%cm.mix;)>
<!ELEMENT content-model (%cm.mix;)>
<!ELEMENT inclusions (%cm.mix;)>
<!ELEMENT exclusions (%cm.mix;)>
<!ELEMENT sequence-group (%cm.mix;)*>
<!ATTLIST sequence-group
occurrence CDATA #IMPLIED
>
<!ELEMENT or-group (%cm.mix;)*>
<!ATTLIST or-group
occurrence CDATA #IMPLIED
>
<!ELEMENT and-group (%cm.mix;)*>
<!ATTLIST and-group
occurrence CDATA #IMPLIED
>
<!ELEMENT element-name EMPTY>
<!ATTLIST element-name
name CDATA #REQUIRED
occurrence CDATA #IMPLIED
>
<!ELEMENT parament-name EMPTY>
<!ATTLIST parament-name
name CDATA #REQUIRED
>
<!ELEMENT empty EMPTY>
<!ELEMENT pcdata EMPTY>
<!ELEMENT cdata EMPTY>
<!ELEMENT rcdata EMPTY>
<!ELEMENT attlist (attdecl, attribute+)>
<!ATTLIST attlist
name CDATA #REQUIRED
>
<!ELEMENT attdecl (#PCDATA)>
<!ELEMENT attribute EMPTY>
<!ATTLIST attribute
name CDATA #REQUIRED
type CDATA #REQUIRED
enumeration (yes|no|notation) #IMPLIED
value CDATA #REQUIRED
default CDATA #REQUIRED
>
π SEE ALSO π
your little squad of related pages, go read them:
dtdparsedtdformatdtddiffdtdflattenSGML::DTDParse::DTD
π PREREQUISITES π
these ones listed here apply to all the modules and scripts, periodt:
Getopt::Long, Text::DelimMatch, XML::Parser, XML::DOM
and for prerequisites that only apply to one specific script or module? go check the individual scripts' and modules' reference pages, bestie π₯
π AVAILABILITY π
<http://dtdparse.sourceforge.net/>
π AUTHORS π
DTDParse package originally developed by Norman Walsh, <ndw@nwalsh.com>.
Earl Hood, <earl@earlhood.com>, picked up support and maintenance. π«Ά
β COPYRIGHT AND LICENSE β
Copyright (C) 1999-2001, 2003 Norman Walsh
Copyright (C) 2005, Earl Hood
DTDParse may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the DTDParse distribution.
lowkey important, highkey legally binding β read the license, it's in the distribution π
okay that's the whole page, mwah π this one's perl v5.32.1, dated 2022-01-21, and yes it lives at SGML::DTDParse(3pm) in the User Contributed Perl Documentation. go parse something iconic, bestie πβ¨π¦
π¦ where this page comes from
- debian bookworm: libsgml-dtdparse-perl 2.00-3 Β· Artistic-1.0-Perl OR GPL-2.0-only
- debian trixie: libsgml-dtdparse-perl 2.00-3 Β· Artistic-1.0-Perl OR GPL-2.0-only
- ubuntu jammy: libsgml-dtdparse-perl 2.00-3 Β· Artistic-1.0-Perl OR GPL-2.0-only
- ubuntu noble: libsgml-dtdparse-perl 2.00-3 Β· Artistic-1.0-Perl OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms