[oXygen-user] XInclude and ID/IDREF validation
George Cristian Bina
Fri Jul 23 03:24:26 CDT 2010
Hi Wendell,
When you use XInclude and DTDs the validation is performed on each file
as it is (with the XInclude elements not expanded). This is how Xerces
works - I opened some time ago a discussion about support for post
validation, you can find that here:
http://mail-archives.apache.org/mod_mbox/xerces-j-dev/200507.mbox/thread
see the
"Xinclude with XML Schema versus XInclude with DTD" messages
If you use XML Schema or Relax NG or Schematron then the validation will
be performed on a document with all the XInclude elements replaced with
the included content.
A possible solution if you need to stay with DTDs is to move the
ID/IDREF constraints from DTDs to a Schematron schema. That needs to be
applied only on the main document and as I said above the resolved
document will be seen by the Schematron validation.
Another solution is to use LIBXML for validation - by default we set the
--postvalid option on LIBXML that makes the processor perform the DTD
validation after the XInclude processing, thus validating the resolved
document against the DTD of the main file.
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On 7/22/10 7:33 PM, Wendell Piez wrote:
> Hi,
>
> This is a classic problem, probably with a simple solution (or
> workaround), but I can't locate it.
>
> What can I do to get ID/IDREF to work across file boundaries when
> using XInclude to construct a document with several modules?
>
> I have tried setting up a Validation Scenario naming the master
> document, and when subordinate modules are validated, this appears to
> be working, inasmuch as I get validation errors for all modules
> (including the master) when I validate any of them. But IDREF values
> in attributes fail validation when their corresponding ID values are
> in other modules.
>
> I am figuring that this is either a setting I have failed to make
> correctly (where should I be looking?), or maybe a limitation of some
> kind, such as that when XInclude is involved, only attributes named
> @xml:id are respected (this is a wild guess), not just any attribute
> declared as type ID in the DTD (which is what I have).
>
> Or maybe I will have to consider going back to external parsed
> entities? I am very reluctant to do this, since the subordinate
> documents need their own DOCTYPE declarations to pick up entity
> declarations of their own, and of course these aren't legal in
> external parsed entities.
>
> I know this is/was a bugaboo in the specification of XInclude, but
> was figuring that in the time since its inception, solutions have emerged....
>
> Thanks for any tips, as always.
>
> Cheers,
> Wendell
>
>
>
> ======================================================================
> Wendell Piez mailto:
> Mulberry Technologies, Inc. http://www.mulberrytech.com
> 17 West Jefferson Street Direct Phone: 301/315-9635
> Suite 207 Phone: 301/315-9631
> Rockville, MD 20850 Fax: 301/315-8285
> ----------------------------------------------------------------------
> Mulberry Technologies: A Consultancy Specializing in SGML and XML
> ======================================================================
>
> _______________________________________________
> oXygen-user mailing list
>
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
More information about the oXygen-user
mailing list