K
K
Ken Jee2015-08-18 23:05:50
PHP
Ken Jee, 2015-08-18 23:05:50

How to validate XML against your own DTD in PHP?

The crux of the matter is this. Uploading the XML file to the server. Next, you need to validate it against the DTD file already on the server. I tried using DOMDocument::validate , but it doesn't return a bool like the documentation says, but throws an Exception. Moreover, DOMDocument::validate requires that the path to the DTD file be pre-written in the XML file. And you need to validate the loaded XML file with your own DTD, ignoring the XML specified inside. Maybe someone faced a similar problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
krypt3r, 2015-08-19
@krypt3r

Maybe schemaValidate()?
PS. Haven't tried it myself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question