PDA

View Full Version : Validating XML


butterfly
12-20-2002, 08:16 PM
Hi everyone,

I would like to validate a XML file by using SAX API. I don't know which API is the right one. Also, how and where do I have to filesave the SAX API. Forte for Java 1.4 is available on my computer.

Thank you!

jkd
12-20-2002, 08:24 PM
Wouldn't it be easier to write a Schema or DTD to validate the XML file?

butterfly
12-20-2002, 08:32 PM
Originally posted by jkd
Wouldn't it be easier to write a Schema or DTD to validate the XML file?

Thank you.
But I am writting a program with user interface in Java. I want that the user opens one xml file at first and then click on a button to check the validation of this xml file.

brothercake
12-27-2002, 05:21 PM
PHP SAX has no validation; it doesn't even check well-formedness. I assume that Java SAX is the same, but I don't know for a fact.

If you need XML validation then I suggest you install an XSLT processor, such as Sablotron (http://www.gingerall.com/charlie/ga/xml/p_sab.xml)

But you would still need to write DTD/Schemas for them - unless I'm very much mistaken - without a DTD or Schema an XML doc can never be valid, because the validity of a document is a comparison with its definition.