Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

Copies current and all child xml nodes from sourceXPath to target xpath or target navigator.

Xml myXml.Copy(sourceXPath: string, target: ( string | Xml ))

Arguments

string sourceXPath
to copy. If you want to use current node specify as ".".
( string | Xml ) target
Target Xml 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.

Assume $Xml content has following data;

Example

Sample Data

<root>
  <Person>
    <Name>john</Name>
    <Surname>x</Surname>
  </Person>
  <Person2>
    <Name></Name>
    <Surname></Surname>
  </Person2>
</root>

Example

Copy Simple Node

$Xml.Copy( 'Person/Name', 'Person/Surname' );

Example

Copy complex node

$Xml.Copy( 'Person', 'Person2' );
  • No labels