Metodo _XDocument2.CreateDOM
Crea una nuova istanza del modello DOM (Document Object Model) XML in memoria.
Questo metodo non è compatibile con CLS.
Spazio dei nomi: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in microsoft.office.interop.infopath.semitrust.dll)
Sintassi
<DispIdAttribute(48)> _
Function CreateDOM As IXMLDOMDocument
Dim instance As _XDocument2
Dim returnValue As IXMLDOMDocument
returnValue = instance.CreateDOM
[DispIdAttribute(48)]
IXMLDOMDocument CreateDOM ()
Valore restituito
IXMLDOMDocument della nuova istanza del modello DOM (Document Object Model) XML.
Osservazioni
Utilizzare il metodo CreateDOM per creare un'istanza del documento DOM XML equivale a utilizzare il metodo seguente per creare un oggetto DOMDocument di Microsoft XML Core Services (MSXML) 5.0:
var objDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
![]() |
---|
Possono accedere a questo membro solo moduli eseguiti nello stesso dominio del modulo aperto oppure moduli a cui sono state concesse autorizzazioni tra domini. |
![]() |
---|
Durante l'automazione di InfoPath, il metodo setProperty dell'oggetto IXMLDOMDocument2 potrebbe avere esito negativo per le origine dati secondarie. Per utilizzare il metodo setProperty, procedere come illustrato di seguito: |
IXMLDOMDocument2 myDocument = (IXMLDOMDocument2) thisXDocument.CreateDOM();
myDocument.setProperty("SelectionNameSpaces",namespaceString);
Esempio
// 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);
Vedere anche
Riferimenti
Interfaccia _XDocument2
Membri _XDocument2
Spazio dei nomi Microsoft.Office.Interop.InfoPath.SemiTrust