[Zope] Some ideas for ZCatalog and XMLDocument

Jason Jones jason.jones@awl.com
Fri, 3 Sep 1999 10:18:51 -0500


I've been using ZCatalog and XMLDocument for a bit now and am really
impressed. These are fantastic tools. Seeing as how they're pretty early in
their development though, I couldn't resist the urge to comment on some
ideas for the future.

1. ZCatalog should be able to index objects according to user defined
criteria (such as indexing on anchors in text, on in-text meta-data, etc...)
so that matched positions can be specifically targeted.

2. ZCatalog should be able to return text hits in a user defined context,
the easy way would be to have this context determined by the method 1. For
instance if my boundary is anchor based, then context could be all text
corresponding to that anchor chunk.

3. XML should be a built in system type, not confined to an XMLDocument. My
thinking is that it would be great if I could register a DTD (or Schema)
with zope, and then do something like <dtml-var text_content fmt="XML:my">
where "my" is a registered DTD, and then use dtml based render methods, or
an associated XSL stylesheet to format my output.

4. ZCatalog should be integrated with the above XSL services. When you
register a dtd or schema with zope, you should then be able to set up
indexes on elements and attributes of that schema (just like you do on
properties of regular objects). ZCatalog could then be used as an XQL engine
as well.

Ultimately it would be great to do something like this:

registered dtd:

<!DOCTYPE EXAMPLE [
<!ELEMENT article (title, author, abstract, body, discussion, references)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT abstract (#PCDATA, ital, bold)>
<!ELEMENT body (#PCDATA, p, ital, bold, head1, head2, head3, math, image,
list)>
..... etc .....
]>

Along with the dtd, I would register any number of XSLT documents or render
methods for example:

"formatHTML_xsl"

And I would index elements in the ZCatalog:
   title, author, abstract, body, etc...

Then, with the following XMLDocument text:

<?XML version="1.0" encoding="UTF-8"?>
<article>
<title>Example Article</title>
<author>Me</author>
<abstract>This is <ital>abstract</ital> text</abstract>
<body>
   <head1>This is <ital>body</ital> text</head1>
   <p>This is some general <bold>paragraph</bold> text.</p>
..... etc .....
</article>

I could do something like:

<dtml-in "catalog.searchResults(meta_type='EXAMPLE')"-->
<a href="/<dtml-var "catalog.getpath(data_record_id_)">"><dtml-var
title></a>
<dtml-var abstract fmt="XML:EXAMPLE" render="formatHTML_xsl">
<hr>
</dtml-in>

To return a nicely formatted abstract and link to the full XML article,
which could then be rendered to down like:

<dtml-var article fmt="XML:EXAMPLE" render="formatHTML_xsl">

or if I had another XSLT document called "formatPDA_xsl" then:

<dtml-var article fmt="XML:EXAMPLE" render="formatPDA_xsl">

I left off .dtd and .xsl because they'll be zope objects not file
references.

etc...

Of course, folding in items 1 and 2 with the above, then I could search on
"body" for instance, return a context chunk from indexed <p id=#> tags for
instance, and then jump to the appropriate paragraph section in my body text
in my formatted XMLDocument.

Also, I could identify any random block of text (in a DTML Document for
example) as an XML fragment corresponding to a certain DTD and have it
automatically rendered by the appropriate method or stylesheet.

 Anyway, just some ideas and wishful thinking for the future.

Jason
jason_j@countermedia.org