cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joose Vettenranta <jo...@iki.fi>
Subject XML fragments and fastest way to process it
Date Thu, 18 Mar 2004 10:16:40 GMT
Hi all,

I have a XML-file, which structure is same as the example in the bottom 
of email (it's not a real data, because real data is very difficult to 
understand if not studies that science so I have converted it to easy 
to understand form).

<book> -element has alwyas certain elements, like this one has:
name and page -element

page element always has certain element, like this on has:
number and content -element

content -element have different kind of elements in side it, don't know 
how many and in which order and what kind.

I need to read that content fast in my cocoon script. I'm implementing 
it as a flowscript, but question is:

How to read those content fast (only one page at a time is accessed). I 
think I have these choises:
1) Book and Page to put in to SQL-database and content also, but as a 
XML-block (in a text field in SQL)
2) Book and Page to put in to SQL-database and content to filesystem, 
let's say to {bookid}/{pageid}/content.xml
3) Book, page and content to SQL-database as a XML-block (in a text 
field in SQL)
4) Book, page and content to filesystem, so I just access {bookid}.xml 
and use xslt to extract correct page
5) Book to sql and page and content to filesystem

There might be lot's of people accessing same time those contents, so I 
really need to design it as fast as possible.

in flowscript I was thinking of creating Java-objects from Book, Page 
so I can call stuff like book.getNumberOfPages() and 
page.getNumberOfElements () ...etc...

I also need to access content-elements from flowscript, so I can do 
like, element.isGrammarCorrect (); Every element could have a own 
grammar, like, if every element is in different lang -> different 
grammar. style staff -> example:

for (int i = 0; i < page.getNumberElements (); ++i) {
  element = page.getElement(i);
  do {
   SendPageAndWait ("editpage", "contentID" : element.getId ());
  } while (element.isGrammarCorrect());
}

XML-example file:

<book>
  <name>value</name>
  <page>
   <number>3</number>
   <content>
    <foo />
    <bar />
    <quux />
   </content>
  </page>
  <page>
   <number>4</number>
   <content>
    <ef>..</ef>
    <foo />
    <bar />
   </content>
  </page>
</book>

Thanks,

Joose

-- 
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message