次の方法で共有


previousSibling Property1

 

Contains the previous sibling of the node in the parent's child list.

Script Syntax

var objXMLDOMNode = oXMLDOMNode.previousSibling;  

Example

The following script example creates an IXMLDOMNode object and sets it to the previous sibling of the current node.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");  
var currNode;  
var prevNode;  
xmlDoc.async = false;  
xmlDoc.load("books.xml");  
if (xmlDoc.parseError.errorCode != 0) {  
   var myErr = xmlDoc.parseError;  
   WScript.Echo("You have error " + myErr.reason);  
} else {  
   currNode = xmlDoc.documentElement.childNodes.item(1);  
   prevNode = currNode.previousSibling;  
   WScript.Echo(prevNode.xml);  
}  

Visual Basic Syntax

Set objXMLDOMNode = oXMLDOMNode.previousSibling  

C/C++ Syntax

HRESULT get_previousSibling(  
    IXMLDOMNode **previousSibling);  

Parameters

previousSibling[out, retval]
The left sibling of this node.

C/C++ Return Values

S_OK
The value returned if successful.

S_FALSE
The value returned when there is no previous sibling.

E_INVALIDARG
The value returned if the previousSibling parameter is Null.

Remarks

The property is read-only.

This value depends on the value of the nodeType property.

NODE_ATTRIBUTE

NODE_DOCUMENT

NODE_DOCUMENT_FRAGMENT
Always returns Null; these node types do not appear as children of any other nodes.
NODE_CDATA_SECTION

NODE_COMMENT

NODE_DOCUMENT_TYPE

NODE_ELEMENT

NODE_ENTITY

NODE_ENTITY_REFERENCE

NODE_NOTATION

NODE_PROCESSING_INSTRUCTION

NODE_TEXT
Returns the node immediately preceding this node in its parent's child list. Returns Null if no such node exists.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | IXMLDOMDocument-DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText

See Also

nodeType Property1