[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: XML Repository v. 2]








Lars Martin wrote:

> Hi,
>
> after some days of thinking about the XML Repository interface and
> trying to implement it we stumbled across some problems where we
> have to make some decisions. And now it is time to ask the users
> of ozone.
>
> The aim was or better _is_ a persistent Repository for any kind of
> XML files. The added documents have to have to be kept as "standalone"
> documents - so building _one_ complete document is not a suitable
> solution.
>
> The same persistent document must be accessible via different access
> paths. For this we have introduced a subtype of Element called XLink.
> (lean against the XLink WD from W3C).
>
> public interface XLink extends OzoneRemote, ElementProxy {
>     /** */
>     public Document linkedDocument ();
>     /** */
>     public void init (Document linkTo) throws Exception;
>     }
>
> public interface Repository extends OzoneRemote {
>     /** */
>     public void init (String parserName) throws Exception;
>     /** */
>     public Document rootDocument ();
>     /** */
>     public void setRootDocument (byte[] data) throws Exception;
>     /** */
>     public void addDocument (byte[] data, String accessPath, int accessRights) throws Exception;
>     /** */
>     public void deleteDocument (Element where);
>     /** */
>     public void linkDocument (XLink from, Document to) throws Exception;
>     /** */
>     public Document unlinkDocument (XLink from) throws Exception;
>     /** */
>     public NodeList xpathQuery (String qString, Document pDom) throws Exception;
>     /** */
>     public Node convertNode (Node node) throws Exception;
>     /** */
>     public String parserName ();
>     /** */
>     public void setParserName (String parserName) throws Exception;
>     }
>
> The current design shows that the XML data is parsed at server side.
> The addDocument() method just gets the byte stream. The question is:
> What is to do, if a <!DOCTYPE> Element is parsed that references an
> external DTD-file? Something like
>           <!DOCTYPE STANDARD.DIN SYSTEM "DIN0907.dtd">
> The server side does not know how to handle to find this document b/c
> it resides (mostly?) on client side! Solutions can be:
>   1. make a connection to the client which is adding the document and
>      download the DTD
>   2. initialize the Repository with a set of DTDs to use
>   3. modify the addDocument() method to pass the DTD data to the server
>      and save this for later requests of DTDs
>   4. parse at client side
> Any comments on this?

the most logical solution is 4, but it's also most uneffiecient for current Ozone architecture.
BTW you will have the same problem with external entities too.

In Cocoon this partly solved by associating BaseURL with the document, then at least in HTTP case,
Cocoon know where to look for DTDs and external entities. This similar to 3.

Also maybe possible some mix of 2 and 3. When you can specify in addDocument() if DTD is resides in
Repository or external ...

> In DOM it is not allowed to add Documents as childern of other Documents.
> For this we´ve introduced the XLink Element to store the Document as an
> member of an Element. But XPath is unable to correctly interpret this new
> Element. (something like XLink.getChildNodes() will return null ...).
> So it is impossible to query Documents with just one XPath query. We´ve
> mentioned this in the first "XML Repository" mail - you need two of them.
> First query all Documents which match the location path and then search
> the whole bunch of Documents. Is that mechanism easy to understand for
> users of the XML Repository? Any other solutions?

Maybe it's possible to modify OpenXML DOM for this ?
I mean to implement XLink as non-stard DOM Node type ?
Just an idea :)

>
>
> Regards,
> Lars
> --
> ________________________________________________________________
> Lars Martin                       mailto:lars@softwarebuero.de
> softwarebuero m&b (SMB)            http://www.softwarebuero.de