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 Jan Dvorak <ja...@mathan.cz> on 2004/06/04 15:34:18 UTC

Entity declarations & Validating by XML Schema, not DTD

Hello list members,

I've spent considerable time with this problem already, 
and I cannot see a solution. 

I have a skeleton document that contains lots of external entity references.
However, I don't want to construct a DTD for this document class. I'd rather 
write a XML Schema and have the document validated against that one.

The trouble is, the spec doesn't allow entity declarations outside the 
<!DOCTYPE ...>. But then I have to declare at least the root element, but 
that's not enough. It looks like I should provide a full DTD.

Now, is there an option to switch DTD validation in Xerces off, while allowing 
the <!DOCTYPE ...> bit, and more, processing the entity declarations?

I'd very much appreciate any hints you might have.

Jan Dvorak
MathAn Praha, Ltd.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by Jan Dvorak <ja...@mathan.cz>.
Hi,

thanks for the hint. I set both the http://java.sun.com/xml/jaxp/properties/
schemaLanguage and the http://java.sun.com/xml/jaxp/properties/schemaSource 
properties, but cannot see any difference. The parser still complains about 
the 'wrapper' element declaration missing - 'wrapper' being my root element. 
I do have it declared in my schema though.

Is there a specific parser configuration I should start with?
I currently use org.apache.xerces.parsers.XMLGrammarCachingConfiguration,
as I want to avoid parsing the same schema over and over,
but I certainly could base my parsers on any other configuration.

Thanks for your help so far,

Jan


Dne pátek 04 červen 2004 17:52 George Cristian Bina napsal(a):
| Hi Jan,
|
| See the http://java.sun.com/xml/jaxp/properties/schemaLanguage property
| at http://java.sun.com/xml/jaxp/change-requests-11.html
|
| Hope that helps,
|   George
| -----------------------------------------------
| George Cristian Bina
| <oXygen/> XML Editor & XSLT Editor/Debugger
| http://www.oxygenxml.com
|
| Jan Dvorak wrote:
| > Hello list members,
| >
| > I've spent considerable time with this problem already,
| > and I cannot see a solution.
| >
| > I have a skeleton document that contains lots of external entity
| > references. However, I don't want to construct a DTD for this document
| > class. I'd rather write a XML Schema and have the document validated
| > against that one.
| >
| > The trouble is, the spec doesn't allow entity declarations outside the
| > <!DOCTYPE ...>. But then I have to declare at least the root element, but
| > that's not enough. It looks like I should provide a full DTD.
| >
| > Now, is there an option to switch DTD validation in Xerces off, while
| > allowing the <!DOCTYPE ...> bit, and more, processing the entity
| > declarations?
| >
| > I'd very much appreciate any hints you might have.
| >
| > Jan Dvorak
| > MathAn Praha, Ltd.
| >
| >
| > ---------------------------------------------------------------------
| > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
| > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
| For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by George Cristian Bina <ge...@sync.ro>.
Hi Jan,

See the http://java.sun.com/xml/jaxp/properties/schemaLanguage property 
at http://java.sun.com/xml/jaxp/change-requests-11.html

Hope that helps,
  George
-----------------------------------------------
George Cristian Bina
<oXygen/> XML Editor & XSLT Editor/Debugger
http://www.oxygenxml.com


Jan Dvorak wrote:
> Hello list members,
> 
> I've spent considerable time with this problem already, 
> and I cannot see a solution. 
> 
> I have a skeleton document that contains lots of external entity references.
> However, I don't want to construct a DTD for this document class. I'd rather 
> write a XML Schema and have the document validated against that one.
> 
> The trouble is, the spec doesn't allow entity declarations outside the 
> <!DOCTYPE ...>. But then I have to declare at least the root element, but 
> that's not enough. It looks like I should provide a full DTD.
> 
> Now, is there an option to switch DTD validation in Xerces off, while allowing 
> the <!DOCTYPE ...> bit, and more, processing the entity declarations?
> 
> I'd very much appreciate any hints you might have.
> 
> Jan Dvorak
> MathAn Praha, Ltd.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by Joseph Kesselman <ke...@us.ibm.com>.



XML Schemas do not have the concept of entity declarations. You can switch
to some other kind of preprocessing, or you can stick with DTDs

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
George Cristian Bina <ge...@sync.ro> wrote on 06/10/2004 04:15:49 AM:

<snip/>

> 2. It has some problems with the validation when XML Schemas are 
> specified. It tries to validate the included document also against a DTD 

> and reports some errors that can be ignored. There is a bug entry on 
> Jira... looking up for the URL... here it is:
> http://nagoya.apache.org/jira/browse/XERCESJ-843

To ensure that only the aggregate document is schema validated, the 
XInclude handler sets the schema feature to false to keep the child 
pipeline it creates from containing a schema validator. This will activate 
the DTD validator on the child pipeline if the validation feature was set 
to true. I've put this bug on my TODO list.

Thanks.

> Best Regards,
> George
> -----------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor & XSLT Editor/Debugger
> http://www.oxygenxml.com

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

Re: Entity declarations & Validating by XML Schema, not DTD

Posted by George Cristian Bina <ge...@sync.ro>.
Jan,

If you set the http://java.sun.com/xml/jaxp/properties/schemaLanguage 
property I pointed you to in my previous post Xerces will perform the 
validation against the specified XML Schema and not against the 
specified DTD. In this way you can mix XML Schemas and entities.

XInclude is surely a choice, just two notes:

1. Xerces 2.6.2 uses the http://www.w3.org/2003/XInclude namespace while 
the last recommandation changed back the namespace to the old 
http://www.w3.org/2001/XInclude namespace. You should use a more recent 
build of Xerces in order to use the http://www.w3.org/2001/XInclude 
namespace:
http://gump.covalent.net/jars/latest/xml-xerces2/

2. It has some problems with the validation when XML Schemas are 
specified. It tries to validate the included document also against a DTD 
and reports some errors that can be ignored. There is a bug entry on 
Jira... looking up for the URL... here it is:
http://nagoya.apache.org/jira/browse/XERCESJ-843

Best Regards,
George
-----------------------------------------------
George Cristian Bina
<oXygen/> XML Editor & XSLT Editor/Debugger
http://www.oxygenxml.com


Jan Dvorak wrote:
> It seems like having a <!DOCTYPE ... > in the document 
> will always start a DTD validation, which is a no-go for me.
> 
> Someone recently pointed me at XInclude, which seems to be a better fit with 
> XML Schema. I'll drop the entity declarations & references from my skeleton 
> document and plug in the Includes instead.
> 
> Thanks to everyone who participated in this discussion,
> 
> Jan Dvorak
> MathAn Praha, Ltd.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by Jan Dvorak <ja...@mathan.cz>.
It seems like having a <!DOCTYPE ... > in the document 
will always start a DTD validation, which is a no-go for me.

Someone recently pointed me at XInclude, which seems to be a better fit with 
XML Schema. I'll drop the entity declarations & references from my skeleton 
document and plug in the Includes instead.

Thanks to everyone who participated in this discussion,

Jan Dvorak
MathAn Praha, Ltd.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entity declarations & Validating by XML Schema, not DTD

Posted by Joseph Kesselman <ke...@us.ibm.com>.



Forgot to say: Or you can use DTD syntax to define your entities and
schemas to do structural validation....

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org