Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Adds a new schema to the schema collection and associates the given namespace Uniform Resource Identifier (URI) with the specified schema.

Script Syntax

Copy Code
objXMLDOMSchemaCol.add(
namespaceURI, 
var);

Remarks

Script Parameters

namespaceURI

This is the namespace to associate with the specified schema. The empty string, "", will associate the schema with the empty namespace, xmlns="".

This may be any string that can be used in an xmlnsattribute, but it cannot contain entity references. The same white space normalization that occurs on the xmlnsattribute also occurs on namespaceURI(that is, leading and trailing white space is trimmed, new lines are converted to spaces, and multiple adjacent white space characters are collapsed into one space).

var

Specifies the schema to load. It will load it synchronously and with resolveExternals=false and validateOnParse=false. The schemas Propertyparameter can also be any DOMDocument.

This argument can be Null, which results in the removal of any schema for the specified namespaces. If the schema is an IXMLDOMNode, the entire document the node belongs to will be preserved

Script Return Value

None

C/C++ Syntax

Copy Code
HRESULT add(
  BSTR 
namespaceURI,
  VARIANT 
var
);

Remarks

C/C++ Parameters

namespaceURI

[in] This is the namespace to associate with the specified schema.

The empty string, "", will associate the schema with the empty namespace, xmlns="". This may be any string that can be used in an xmlnsattribute, but it cannot contain entity references. The same white space normalization that occurs on the xmlnsattribute also occurs on this parameter (that is, leading and trailing white space is trimmed, new lines are converted to spaces, and multiple adjacent white space characters are collapsed into one space).

var

[in] This specifies the schema. It can be a BSTR, in which case it points to the URL to load. It will load it synchronously and with resolveExternals=false and validateOnParse=false. var can also be any DOMDocument.

This argument can be Null, which results in the removal of any schema for the specified namespaces. If the schema is an IXMLDOMNode, the entire document the node belongs to will be preserved.

C/C++ Return Value

If this call fails, the collection remains unchanged. E_FAIL is returned if:

  • the collection is read-only.

  • the document is not a recognized schema.

  • an error occurs when compiling the schema.

  • the ready state of the document is not 4.

If it was loading a schema and encountered a parse error, then the parse error reason is returned in the IErrorInfo. E_INVALIDARG is returned if the VARIANT argument contains an invalid value.

C/C++ Requirements

OS Versions: Windows CE .NET 4.0 and later.

Header: Msxml2.h, Msxml2.idl.

Link Library: Uuid.lib

General Remarks

Schemas referenced by this schema are not added to the collection. The contents of the schema are added to the internal collection. (The schema may be copied.). If a schema is already in the collection with this namespace, it will be replaced by the new one.

This method applies to the following objects and interfaces:

DOMDocument, IXMLDOMNode, and XMLSchemaCache/IXMLDOMSchemaCollection.

See Also

Reference

XML DOM Methods