Share via


add Method (Compact 2013)

3/26/2014

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

Syntax

objXMLDOMSchemaCol.add(namespaceURI, var);
HRESULT add(
  BSTR namespaceURI,
  VARIANT var
);

Parameters

Script

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

    This may be any string that can be used in an xmlns attribute, but it cannot contain entity references. The same white space normalization that occurs on the xmlns attribute 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 Property parameter 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++

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

    The empty string, "", will associate the schema with the empty namespace, . This may be any string that can be used in an xmlns attribute, but it cannot contain entity references. The same white space normalization that occurs on the xmlns attribute 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.

Return Value

Script

None

C/C++

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.

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