Re: [xml] Xinclude w/DTD segs
- From: Bruce Miller <bruce miller nist gov>
- To: xml <xml gnome org>
- Subject: Re: [xml] Xinclude w/DTD segs
- Date: Tue, 19 Jun 2001 11:19:26 -0400
Daniel Veillard wrote:
As far as xmllint is concerned,
xmllint --xinclude --postvalid --noout file.xml
seems to do what I want: parse, do inclusions, and _then_ validate.
But, perhaps, this approach isn't really, um, ... valid :>
Of course in practice people want to validate after parsing, so
I have added APIs to validate an already parsed document or validate
a document against a given DTD. I think all toolkits offers this but
this is not the canonical way of doing things.
[Apologies if this is getting too far from libxml specifically,
I'll _try_ to be brief... ]
I'm still having some problems here. Maybe I was hoping for a
"magic bullet" and am creating a "catch 22" (mixed usa-centric
metaphors?) and I'm having a hard time finding information about
how to use Xinclude.
Both entities & xinclude seem to be useful for different purposes,
eg entities provided by the DTD are like a database; xinclude
allows explicit composition of a document.
There's a trivial example of what I think I want at the bottom.
For a document using _both_
xmllint --xinclude --valid --noent test.xml
complains about the xinclude tags not being defined in the
dtd, which is true.
xmllint --xinclude --postvalidate --noent test.xml
complains about the entities not being defined (during
xinclude expansion?)
I suppose I'd want to process the dtd to get access to the
entities, but not validate till later.
Is this possible with xmllint? Have I not tried the right
combination of options?
Or, must I explicitly declare xinclude in the dtd (and all the
places I'll allow <xi:xinclude> to appear?
Or, am I really on the completely wrong track here?
(and if so, what would you suggest?)
Thanks for your indulgence!
**********
In case I'm not clear, here's an example:
*** test.dtd ***
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT things (thing*)>
<!ELEMENT thing (#PCDATA)>
<!ENTITY default.thing "<thing>Default Thing</thing>">
*** text.xml ***
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE things SYSTEM "test.dtd">
<things>
<thing>An Explicit Thing</thing>
&default.thing;
<xi:include href="testfrag.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"/>
</things>
*** testfrag.xml ***
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE thing SYSTEM "test.dtd">
<thing>An x-included thing</thing>
----------------
Bruce Miller
<bruce miller nist gov> http://math.nist.gov/~BMiller/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]