次の方法で共有


_XDocument3.CreateDOM メソッド

XML ドキュメント オブジェクト モデル (DOM) の新しいインスタンスをメモリに作成します。

このメソッドは、CLS に準拠していません。  

名前空間: Microsoft.Office.Interop.InfoPath.SemiTrust
アセンブリ: Microsoft.Office.Interop.InfoPath.SemiTrust (microsoft.office.interop.infopath.semitrust.dll 内)

構文

'宣言
<DispIdAttribute(48)> _
Function CreateDOM As IXMLDOMDocument
'使用
Dim instance As _XDocument3
Dim returnValue As IXMLDOMDocument

returnValue = instance.CreateDOM
[DispIdAttribute(48)] 
IXMLDOMDocument CreateDOM ()

戻り値

XML ドキュメント オブジェクト モデル (DOM) の新しいインスタンスからアクセスできる IXMLDOMDocument

コメント

CreateDOM メソッドを使用して XML DOM のインスタンスを作成するのは、以下のメソッドを使用して Microsoft XML Core Services (MSXML) 5.0 DOMDocument オブジェクトを作成するのと同じことです。

var objDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
メモ重要 :

このメンバは、現在開いているフォームと同じドメイン内で実行されているフォーム、またはドメインを越えたアクセス許可を付与されているフォームだけがアクセスできます。

メモメモ :

InfoPath を自動化すると、セカンダリ データ ソースに対して実行した IXMLDOMDocument2 オブジェクトの setProperty メソッドが失敗することがあります。setProperty メソッドを使用するときは、次の例に従ってください。

IXMLDOMDocument2 myDocument = (IXMLDOMDocument2) thisXDocument.CreateDOM();
myDocument.setProperty("SelectionNameSpaces",namespaceString);

// create a new XMLDOMDocument that can be used by InfoPath
IXMLDOMDocument newDOM = thisXDocument.CreateDOM();
// Get one node from the main DOM and add it to the new DOM
IXMLDOMNode referenceNode = thisXDocument.DOM.selectSingleNode("//my:group1");
newDOM.appendChild(referenceNode);
// create a new node that will be added to the new DOM
IXMLDOMNode newNode = newDOM.createNode(1,"my:Group2",referenceNode.namespaceURI);
// Set its value
newNode.text = "this is a group2 node";
// Set the SelectionNamespaces attribute with the namespace used in the new DOM
((IXMLDOMDocument2)newDOM).setProperty("SelectionNamespaces","xmlns:my='" + referenceNode.namespaceURI + "'");
// Select one mode from the new DOM and add the new Node as its child
IXMLDOMNode parentNode = newDOM.selectSingleNode("//my:group1");
parentNode.appendChild(newNode);

関連項目

参照

_XDocument3 インターフェイス
_XDocument3 のメンバ
Microsoft.Office.Interop.InfoPath.SemiTrust 名前空間