You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Fitzharris, Walter M. (LNG-DAY)" <Wa...@lexisnexis.com> on 2003/01/22 15:41:59 UTC
Validating XML with schema plus entities (cake and eat it too)
> I can get the parser to use the schema , but if I uncomment the entities
> lines (see instance doc below), the parser gets confused by them. If I
> leave them commented out, the parser doesn't get the definition of the
> entities in the instance doc and croaks when it hits the first entity ref.
>
>
My only solution so far is to "preprocess" the instance file with a perl
script and replace entities in it before the parser ever sees it.
> Can I make the parser read the entity defs in directly from the file? Or
> is there a way to tell the parser that the DOCTYPE prolog is not really
> the DTD definition, to please ignore it except for the entity defs, and
> use the XSD to validate?
>
> Here's a sample xml instance :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!--DOCTYPE document
> [
> <!ENTITY foo "my good">
> <!ENTITY % ents SYSTEM "my_entity_defs.ent">
> %ents;
> ]-->
> <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="foo.xsd">
> <page>Sammy — &foo; dog</page>
> </document>
>
> Walt Fitzharris
> Lexis Nexis
> 937-865-6800 X54641
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org