[
Lists Home |
Date Index |
Thread Index
]
On Fri, 2004-01-09 at 12:24, Eliasen Jan wrote:
> Hi
>
> I need to write a C++ program that takes an xml-document as input, and
> checks that it is valid xml and also validates the xml against a DTD.
>
> Does anyone have any ideas where to search? I have searched Google
> (naturally) and found xercesc, but that seems to be quite a package,
Give LibXML a look. It might be what you need.
NSGMLS is old but good.
> and definately a lot more than I need, I suppose? Most others I have
> found claim to be non-validating. There will not be a
> DOCTYPE-declaration in my xml-files.
>
> Any help is appriciated.
>
If you want to validate against a DTD, most parsers assume you have a
DOCTYPE declaration in the XML document. However, it fairly easy to work
around this, for example by prepending a DOCTYPE declaration before
handing the document over to the parser. (If your files have an XML
declaration, you will have to strip it off before prepending the
DOCTYPE.)
You can also generate the DOCTYPE declaration and then include your
document using an entity.
/Henrik Mårtensson
|