[sword-devel] XML handling in filters

Troy A. Griffitts sword-devel@crosswire.org
Sat, 08 Jun 2002 14:49:31 -0700


Victor: 
Thanks for the work.  Looking forward to taking some time soon to try it 
out.


Everyone,
	A few things to consider...  SWBasicFilter needs to work on document 
fragments.  It works on a per verse basis, thus there may be something 
like: Jesus said, <q>I am the Way, the Truth, and the Life.  And the 
next verse may have: No one comes to the Father, except by Me.</q>

The text of a verse cannot be guaranteed to be wellformed XML, as seen 
above.

	This will be much more prevalent when OSIS texts are introduced into the 
engine.

	A solution we will need to implement will be a 'tagContext', or 'inTag' 
mechanism, so that a filter can know, "hey, you're current state is that 
you are down in 3 levels of quotation and your last level is a BLOCK 
QUOTE, so you need to render appropriately."  something like: 
tagContext="<q speaker="God"><q speaker="Ezekiel"><q speaker="God" 
type="block">"

	I've been thinking of ways to implement this over the past few months. 
Some ideas are module/testament/book/chapter level pattern matches, with 
a mask integer on each verse, chapter, book, testament to designate context:

Example:

This entire _module_ has this 'head' information that applies to most 
every (probably every) part of the module, it has this pattern assigned 
to 'module' bit 1

This _book_ is no exception, so it's 'module' bits are 000000001.  This 
book has 30 places in it that match the context: <q speaker="Jesus"> and 
is assigned book pattern bit 1.

This _chapter_ entirely matches the above book pattern, so this chapters 
'book' bits are 000000001.  There are 10 different patterns that verses 
are 'in' in this chapter, and they are each assigned a bit 1-10 for 
chapter patterns.

This verse is 'in' chapter patterns 1 2 4 and 16, so it's 'chapter' bits 
are 00000000010111.


 From this we can easily walk 4 levels and know exactly our context.

The really hard part is building this information on module creation.


Anyway, don't need to implement yet, so just keep it in your minds as we 
move forward.