XmlNode.Copy
Overview¶
XmlNode XmlNode.Copy ( sourceXPath, target )
Arguments¶
String sourceXPath
XPath to copy. If you want to use current node specify as ".".
XmlNode | String target
Target XmlNode or Xpath to be copy.
Remarks¶
This method tries to find type of copying node from XML schema. If the related scheme is found, the operation is copied based on XML scheme definitions. Otherwise it copies only name matching nodes.
Copying by XML scheme definitions automatically resolves collection items and creates new nodes.
Examples¶
Assume $Xml content has following data;
Sample Data
<root> <Person> <Name>john</Name> <Surname>x</Surname> </Person> <Person2> <Name></Name> <Surname></Surname> </Person2> </root>
Copy Simple Node
$Xml.Copy( 'Person/Name', 'Person/Surname' );
$Xml.Copy( 'Person', 'Person2' );