http://qs321.pair.com?node_id=119980

iza has asked for the wisdom of the Perl Monks concerning the following question: (data formatting)

I have an XML file and its DTD file. What module can I use to parse the XML and validate it against the DTD?

Originally posted as a Categorized Question.

  • Comment on How to validate an XML file against its DTD?

Replies are listed 'Best First'.
Re: How to validate an XML file against its DTD?
by davorg (Chancellor) on Oct 19, 2001 at 18:19 UTC
Re: How to validate an XML file against its DTD?
by Corion (Patriarch) on Oct 20, 2001 at 01:38 UTC

    There is a pure XSL(T) answer: the Schematron. It's an XSLT stylesheet; you run it on the DTD, and this produces a second stylesheet, which is a validator for the DTD. You run that on your XML to validate it.

Re: how do i check an xml file against its dtd ?
by tommyw (Hermit) on Oct 19, 2001 at 18:21 UTC

    Dunno about a perl module, but emacs' psgml library invokes nsgmls -s sample.xml, which might help

    Originally posted as a Categorized Answer.

Re: how do i check an xml file against its dtd ?
by Anonymous Monk on Sep 05, 2003 at 11:23 UTC
    <?xml version="1.0" ?> <FINTRANSACTION FTNO= "FT01"> <TXN_TYPE>FINANCIAL TRANSACTION</TXN_TYPE> <TXN> <TXN_NO> FT001 </TXN_NO> <ACCOUNT> 0124221 </ACCOUNT> <AMOUNT> 100,00 </AMOUNT> </TXN> <TXN> <TXN_NO> FT001 </TXN_NO> <ACCOUNT> 0124221 </ACCOUNT> <AMOUNT> 100,00 </AMOUNT> </TXN> <TXN> <TXN_NO> FT001 </TXN_NO> <ACCOUNT> 0124221 </ACCOUNT> <AMOUNT> 100,00 </AMOUNT> </TXN> </FINTRANSACTION>

    Originally posted as a Categorized Answer.