Skip to content

Commit

Permalink
For later
Browse files Browse the repository at this point in the history
  • Loading branch information
jakejackson1 committed Apr 12, 2024
1 parent c5f1174 commit 7a9aeae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions examples/basic-manipulation-filter-and-retrieval/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

require_once __DIR__ . '/../../vendor/autoload.php';

//TODO - consider writeHTML() or writeXML() instead of html() / xml()

/*
* HTML Example
*/
Expand Down
4 changes: 3 additions & 1 deletion examples/create-html-document/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

echo 'You can use QueryPath to build complex HTML documents using a simple jQuery-like API:';

//TODO - consider writeHTML() instead of html()

echo '<pre><code>&lt;?php
// Begin with an HTML5 stub document and navigate to the title.
html5qp(\QueryPath\QueryPath::HTML5_STUB, "title")
echo html5qp(\QueryPath\QueryPath::HTML5_STUB, "title")
// Add text to the title
-&gt;text("Example of QueryPath.")
// Traverse to the root of the document, then locate the body tag
Expand Down
10 changes: 8 additions & 2 deletions examples/create-xml-document/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@
* By default, it will point to the root element `<author />`
*/

//TODO
// Use QueryPath::withXML() will allow you to omit the XML declaration "<?xml version="1.0"?\>"
// \QueryPath\QueryPath::withXML('<author/>')
// ->append('<lastName>Wiseman</lastName>')
// ->writeXML();

try {
echo qp('<?xml version="1.0"?><author></author>')
qp('<?xml version="1.0"?><author></author>')
// Add a new last name inside of author.
->append('<lastName>Wiseman</lastName>')
// Select all of the children of <author/>. In this case,
Expand All @@ -46,7 +52,7 @@
// 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();
->writeXML();
} catch (\QueryPath\Exception $e) {
die($e->getMessage());
}

0 comments on commit 7a9aeae

Please sign in to comment.