OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSXML : XMLSchemaCache Object



Can someone explain the exact format for this. I managed to get it working, and i understand how to make it work, jsut an examplanatiomn of 

I created two schemas and loaded both into SchemaCache...

var cache = new ActiveXObject("MSXML2.XMLSchemaCache"); 
cache.add("urn:n", xmlXdr) 
cache.add("urn:m", xmlXdr1)

Now, my XML file...

<?xml version="1.0" ?>
<m:dunno m:somenum="10" xmlns:m="urn:foo">
 <n:some xmlns:n="urn:bar" />
</m:dunno>

Now, this works fine and validates and I can change the integer value "somenum" to a letter and validation fails etc... which is great. It DOES work.

I don't quite get the cache part though and how it relates to the namespaces. I would have thought that prefixes in the instance would have been irrelevant and that the namespace would be the main thing connecting the schema in the cache with a part of the XML instance. So you would have defined the prefix "m" to be a particular namespace in the instance (xmlns:m="anything" in my case) and then when you add the relevent schema document to validate that part of the instance to the cache you woudl just use the same namespace and it would associate that schema with that namespace - RATHER than the prefix which works for me.

So, in my case, rather than cache.add("urn:n", xmlXdr) , you would do cache.add("urn:foo", xmlXdr).

Can someone explain why this happens? Surely the context of the schema should be based on the namespace rather than whatever prefix you decide to use!?

Thanks,
Steven