At 09:34 8/12/00 +0100, Stefan Bodewig wrote:
>>>My first thought was to enforce order here - force the user to
>>>always add the child elements first for example - but I realize that
>>>you cannot constrain the order for elements with mixed content. You
>>>cannot do that in a DTD but we could make that a rule in Ant, though
>>>I'm not sure the XML parser would expose this to Ant.
>>
>> You can force order by just throwing a SAXException in the handler
>> thats not a problem but that approach feels very unnatural to me.
>
>Sure? AFAIK, it is not defined whether characters() will be invoked
>once for all content or several times, that's why I'm not sure you'd
>recognize whether content came before or after child elements.
well its the way the parser I use behaves ;) Heres the documentation from
SAX ContentHandler (SAX2) so I assume that in SAX2 at least it is true.
Thou I would expect it to be or else you would have difficulty using it for
HTML DOM implementations.
* <p>The Parser will call this method to report each chunk of
* character data. SAX parsers may return all contiguous character
* data in a single chunk, or they may split it into several
* chunks; however, all of the characters in any single event
* must come from the same external entity so that the Locator
* provides useful information.</p>
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*