Hi Daniel,

Daniel Jackson <[EMAIL PROTECTED]> writes:

> Ok, I think I got it. I'm not sure how I would use this in my system though.
> Basically I have something like 100 schemas that the XMLs I validate might
> need. So if I understand what you're saying correctly, before starting to
> actually parse the XMLs I should load all those schemas into a
> XMLGrammarPool and only when that loading is completed I should start the
> parsing.

That would be the easiest way. Another alternative would be to have an
upgradable rw mutex corresponding to the XMLGrammarPool instance. When
starting the parsing process in a thread you would read-lock this mutex.
If the entity resolver is called during parsing to resolve the schema
(that is, a cache miss) then you would relock the mutex to write-lock
before returning the schema. This will ensure that the parser invocation
which adds the schema to the pool uses the pool exclusively. Then when
the parser returns you release the lock. I think this will work.

Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to