Table of contents
TOC
折叠目录
展开目录

CustomXMLSchemaCollection.Add 方法 (办公室)CustomXMLSchemaCollection.Add Method (Office)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

通过该方法,可以将一个或多个架构添加到架构集合中,该集合然后可被添加到数据存储中的流以及架构库中。Allows you to add one or more schemas to a schema collection that can then be added to a stream in the data store and to the Schema Library.

语法Syntax

表达式添加(属性别名文件名InstallForAllUsers )expression. Add( NamespaceURI, Alias, FileName, InstallForAllUsers )

表达式_该表达式返回一个CustomXMLSchemaCollection对象。_expression An expression that returns a CustomXMLSchemaCollection object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
属性NamespaceURI可选OptionalStringString包含要添加到集合中的架构的命名空间。如果在架构库中已存在架构,该方法将检索它从那里。Contains the namespace of the schema to be added to the collection. If the schema already exists in the Schema Library, the method will retrieve it from there.
别名Alias可选OptionalStringString包含要添加到集合中的架构的别名。如果别名在架构库中已存在,则方法可以使用此参数找到它。Contains the alias of the schema to be added to the collection. If the alias already exists in the Schema Library, the method can find it using this argument.
文件名FileName可选OptionalStringString包含在磁盘上的架构的位置。如果指定此参数,则架构添加到集合和向架构库。Contains the location of the schema on a disk. If this parameter is specified, the schema is added to the collection and to to the Schema Library.
InstallForAllUsersInstallForAllUsers可选OptionalBooleanBoolean指定是否在其中方法是将架构添加到架构库的情况下,架构库密钥应写入置此变量对所有用户) 或只是当前用户的注册表的注册表。参数默认为False ,并写入注册表。Specifies whether, in the case where the method is adding the schema to the Schema Library, the Schema Library keys should be written to the registry(HKey_Local_Machine for all users or HKey_Current_User for just the current user). The parameter defaults to False and writes to HKey_Current_User.

返回值Return Value

CustomXMLSchemaCustomXMLSchema

示例Example

以下示例将架构添加到架构集合,从集合中选择单一的节点,然后将该节点返回到调用过程。The following example adds a schema to the schema collection, selects a single node from it, and then returns the node to the calling procedure.

Function AddSchema() 
    On Error GoTo Err 

    Dim objCustomXMLSchemaCollection As CustomXMLSchemaCollection 
    Dim cxp1 As  CustomXMLSchema 
    Dim cxn As CustomXMLNode 

    ' Adds a schema to the collection. 
    cxp1 = objCustomXMLSchemaCollection.Add("urn:invoice:namespace", "coreDefinitions", wdCore.xsd", True) 

... 

    Set cxn = cxp4.SelectSingleNode("//*[@quantity < 4]") 

    AddSchema = cxn 

    Exit Function 

' Exception handling. Show the message and resume. 
Err: 
        MsgBox (Err.Description) 
        Resume Next 
End Function 

另请参阅See also

概念Concepts

CustomXMLSchemaCollection 对象CustomXMLSchemaCollection Object

其他资源Other resources

CustomXMLSchemaCollection 对象成员CustomXMLSchemaCollection Object Members

© 2018 Microsoft