Hi Daniel,

Sorry for the previous email -- hit send accidently.

Daniel Jackson <[EMAIL PROTECTED]> writes:

> So basically if I have schema A that includes schema B (both have the same
> namespace) and I create an in-memory schema that includes both of them and
> has the same namespace, I could use loadGrammar to load all 3 and then the
> XML file should pass validation. Is this correct?

Yes, if the XML file conforms to the vocabulary defined by A and B.


> I just tried this and got a RuntimeException, predictably since it tried
> loading the other schemas from the in-memory one and failed because the
> schemaLocation value didn't point to the correct physical path. This is why
> I said I can't rely on the schemaLocation attribute.

Ok, I think I now understand what's going on. The files mentioned in
schemaLocation are resolved relative to the path of the including
schema. What you need to do is pass a path as a system id to
MemBufInputSource (if that's what you are using). That path should
point to the directory where you have included schemas and can have
some non-existent name for the file. For  example, if your schemas
are in /tmp/bar then you would pass "/tmp/bar/fake.xsd" as a system
id. Then all the schemas included by fake.xsd will be resolved
relative to /tmp/bar/.


> I want to handle the resolving of entities during the validation
> (here resolveEntity comes along) and if I try loading using
> loadGrammar it simply tries on it's own. Maybe there's a way to
> make loadGrammar call resolveEntity when it parses the grammar?

I would expect it to. Can you make sure that you set your entity
resolver before you call loadGrammar?

Boris

-- 
Boris Kolpackov, Code Synthesis Tools
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