You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Daniel Burrell <da...@gmail.com> on 2008/07/21 04:49:05 UTC

Validate xml against dtd

As I understand it, when xerces validates an xml against a dtd, the dtd it
validates against is specified in the xml file.
Is it possible to validate an xml file in it's dom form in memory against a
dtd also loaded in memory?

i.e., I would parse the xml file with validation off into a DOM format.
somehow load the dtd into memory (how would this be done?)
and then validate the dom tree against the dtd?

Or can you only validate the contents of an xml file as it's being parsed?

Re: Validate xml against dtd

Posted by Daniel Burrell <da...@gmail.com>.
ok thank you, work around seems good enough

On Mon, Jul 21, 2008 at 5:05 AM, Michael Glavassevich <mr...@ca.ibm.com>
wrote:

> Someone asked a similar question last month [1]. It was regarding XML
> Schema validation but I assume you cannot do it with DTDs either.
>
> FYI ... The Java version of Xerces provides support for in-memory DOM
> validation against DTDs and XML Schemas.
>
> [1] http://marc.info/?l=xerces-c-users&m=121438422020361&w=2
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> "Daniel Burrell" <da...@gmail.com> wrote on 07/20/2008 10:49:05
> PM:
>
> > As I understand it, when xerces validates an xml against a dtd, the dtd
> it
> > validates against is specified in the xml file.
> > Is it possible to validate an xml file in it's dom form in memory against
> a
> > dtd also loaded in memory?
> >
> > i.e., I would parse the xml file with validation off into a DOM format.
> > somehow load the dtd into memory (how would this be done?)
> > and then validate the dom tree against the dtd?
> >
> > Or can you only validate the contents of an xml file as it's being
> parsed?
>

Re: Validate xml against dtd

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Someone asked a similar question last month [1]. It was regarding XML
Schema validation but I assume you cannot do it with DTDs either.

FYI ... The Java version of Xerces provides support for in-memory DOM
validation against DTDs and XML Schemas.

[1] http://marc.info/?l=xerces-c-users&m=121438422020361&w=2

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Daniel Burrell" <da...@gmail.com> wrote on 07/20/2008 10:49:05
PM:

> As I understand it, when xerces validates an xml against a dtd, the dtd
it
> validates against is specified in the xml file.
> Is it possible to validate an xml file in it's dom form in memory against
a
> dtd also loaded in memory?
>
> i.e., I would parse the xml file with validation off into a DOM format.
> somehow load the dtd into memory (how would this be done?)
> and then validate the dom tree against the dtd?
>
> Or can you only validate the contents of an xml file as it's being
parsed?