Frequently Asked Questions about the SOM
The following are some frequently asked questions about the SOM.
How do I get a schema object that I can query?
You obtain a schema object from a schema cache. The schema cache is created with the IXMLDOMSchemaCollection2 interface. For more information, see Loading a Schema for Use with the ISchema Interface, and the ISchema interface reference topic.
Return to Top
What is the schema cache used for?
The schema cache is an object created with the IXMLDOMSchemaCollection2 interface. The schema cache stores XML Schema documents according to an associated target namespace. The target namespace must be unique for each XML Schema in the cache.
Return to Top
What schema version does the SOM use?
The SOM uses the XML Schema definition language (XSD) as its schema platform. The W3C recommendation for the XML Schema is found at http://www.w3.org/2001/XMLSchema#intro. This recommendation includes a link to http://www.w3.org/2001/XMLSchema.xsd, the XML Schema that is used to validate XML Schema elements, attributes, and data types.
See Also
XML Schema Reference (XSD)
Return to Top
What does the W3C have to do with the SOM?
The SOM conforms to the W3C specifications, which are available at the Web site www.w3.org/TR/xmlschema-0/. SOM interfaces are created from the schema component definitions. For an example of the definitions for an element, see the specifications document, at URL http://www.w3.org/TR/xmlschema-1/#Element_Declaration_details.
The rest of the definitions can be found throughout the specifications document.
Return to Top
How does the DOM work with the SOM?
The DOM has two methods that return a schema object. The first is the getDeclaration method of the IXMLDOMSchemaCollection2 interface. The second is the getSchema method of the IXMLDOMSchemaCollection2 interface. For more information, see Using the DOM with the SOM.
Return to Top
How does SAX work with the SOM?
SAX has two functions that return a schema object. The first is the schemaElementDecl method of the IMXSchemaDeclHandler interface. The second is the getTypeFromName method of the ISAXAttributes interface. For more information, see Using SAX with the SOM.
Return to Top
What is an item collection used for?
An item collection is used throughout the SOM for object storage. Many of the interface functions return item collections that contain an array of specific or mixed objects. The item collection is indexed, and begins with the index of zero. The objects returned in the collection implement their specified interface when they are queried individually. Use the itemType property of the ISchemaItem interface to get the type of the items in the collection.
See Also
ISchema Item Collection Interface
Return to Top
Does the SOM support the multi-thread apartment model?
Yes, the SOM does support the multi-thread apartment model. You can marshal between rental mode and free threaded model in your application.
Return to Top
How has the getDeclaration method changed in MSXML 4.0?
In MSXML 4.0 Beta 2, the getDeclaration method was called using an XMLSchemaCache object. The getDeclaration call has been changed in the MSXML 4.0 official release.
The following Visual Basic example shows the syntax used in MSXML 4.0 Beta 2 to make the getDeclaration method call.
set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.4.0")
nsTarget="http://www.example.org/po"
oSchemaCache.add nsTarget, "po.xsd"
set oDoc = CreateObject("Msxml2.DOMDocument.4.0")
oDoc.async = false
oDoc.load "po.xml"
oDoc.setProperty "SelectionLanguage", "XPath"
Set oDecl = oSchemaCache.getDeclaration(oNode)
The getDeclaration method is now implemented through the namespaces property of the DOMDocument2 object. The getDeclaration method is still part of the IXMLDOMSchemaCollection2 interface, but will return "E_NOTIMPL" when called from the IXMLDOMSchemaCollection interface. The method was modified to include the declarations of XML Schemas used by the associated document. This provides access to XML Schemas loaded using xsi:schemaLocation, as well as XML Schemas loaded from a schema cache object.
The following modified example contains the new syntax used to get a declaration.
set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.4.0")
nsTarget="http://www.example.org/po"
oSchemaCache.add nsTarget, "po.xsd"
set oDoc = CreateObject("Msxml2.DOMDocument.4.0")
oDoc.async = false
oDoc.validateOnParse = false
set oDoc.schemas = oSchemaCache
oDoc.load "po.xml"
oDoc.setProperty "SelectionLanguage", "XPath"
oDoc.setProperty "SelectionNamespaces", "xmlns:po='http://www.example.org/po'"
Set oDecl = oNode.ownerDocument.namespaces.getDeclaration(oNode)
Return to Top