* * * (A space was inserted above to prevent the documentation renderer from * misinterpreting it.) * * @author M Butcher * @license LGPL The GNU Lesser GPL (LGPL) or an MIT-like license. */ require_once '../src/QueryPath/QueryPath.php'; // Create a new XML document wrapped in a QueryPath. // By default, it will point to the root element, // $record = qp('') // Add a new last name inside of author. ->append('Dostoyevsky') // Select all of the children of . In this case, // that is ->children() // Oh, wait... we wanted last name to be inside of a // element. Use wrap to wrap the current element in something: ->wrap('') // And before last name, we want to add first name. ->before('') // Select first name ->prev() // Set the text of first name ->text('Fyodor') // And then after first name, add the patronymic ->after('Fyodorovich') // Now go back to the root element, the top of the document. ->top() // Add another tag -- origin. ->append('Russia') // turn the QueryPath contents back into a string. Since we are // at the top of the document, the whole document will be converted // to a string. ->xml(); // Print our results. print $record;