|
From: Timo V. <sic...@gm...> - 2004-06-26 09:57:41
|
Alef, J=FCrgen,=20 I've done some research. The XInclude spec is quite short (in terms of=20 the W3C), http://www.w3.org/TR/xinclude/ . Digest: XInclude transforms the infoset, thus happens after parsing. XInclude=20 defines only two elements: include and fallback. Include uses IRIs=20 (Internationalized Resource Identifiers, essentially URIs) to reference=20 resources. It can import those resources as xml or text. In case of xml=20 it can use XPointer to include only portions of the resource.=20 > How does the XInclude stuff retrieve the resources. Will it allow us > to specify resources in somewhat the same way as we do now > (classpath:, etcetera) and is it possible to integrate this with the > resource package we have? AFAIK, IRIs/URIs can have application specific form. The XInclude spec=20 explicitly says=20 "The specifics of how an infoset is created are intentionally=20 unspecified, to allow for flexibility by implementations and to avoid=20 defining a particular processing model for components of the XML=20 architecture. Particulars of whether DTD or XML schema validation are=20 performed, for example, are not constrained by this specification." > > Sounds plausible. I'm no XML expert, though: How could we make this > > work? We "only" need a simple layer, which processes all XInclude elements of=20 the infoset (the parsed XML). I couldn't find a simple black box=20 solution, only this: =2D XIncluder, http://xincluder.sourceforge.net/ : Seems to be=20 unmaintained, not feature complete; nevertheless it's the basis for=20 some other projects (XOM, e.g.). =2D GNU JAXP, http://www.gnu.org/software/classpathx/jaxp/ : "includes a=20 SAX filter that resolves XIncludes, provided no XPointers are used" =2D Cocoon XInclude transformer,=20 http://cocoon.apache.org/2.1/userdocs/transformers/xinclude-transformer.htm= l :=20 Seems to be feature complete, but written for use in cocoon The Cocoon stuff might be worth reviewing. BTW, using DTDs for validation has a little drawback: DTDs are not=20 namespace aware. Thus an updated Spring DTD for XInclude would force=20 the user to use a fixed prefix (xi, e.g.). The example I posted was=20 "incorrect", since it defined a namespace in the <beans> tag. FYI, the=20 XInclude spec provides DTD templates (and an XML schema) for XInclude=20 usage: <!ELEMENT xi:include (xi:fallback?)> <!ATTLIST xi:include xmlns:xi CDATA #FIXED =20 "http://www.w3.org/2001/XInclude" href CDATA #IMPLIED parse (xml|text) "xml" xpointer CDATA #IMPLIED encoding CDATA #IMPLIED accept CDATA #IMPLIED accept-language CDATA #IMPLIED > <!ELEMENT xi:fallback ANY> <!ATTLIST xi:fallback xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" > Regards, Timo |