* @license LGPL The GNU Lesser GPL (LGPL) or an MIT-like license. */ require_once '../src/qp.php'; // Begin with an HTML stub document (XHTML, actually), and navigate to the title. qp(QueryPath::HTML_STUB, 'title') // Add some text to the title ->text('Example of QueryPath.') // Now look for the element ->top('body') // Inside the body, add a title and paragraph. ->append('

This is a test page

Test text

') // Now we select the paragraph we just created inside the body ->children('p') // Add a 'class="some-class"' attribute to the paragraph ->attr('class', 'some-class') // And add a style attribute, too, setting the background color. ->css('background-color', '#eee') // Now go back to the paragraph again ->parent() // Before the paragraph and the title, add an empty table. ->prepend('
') // Now let's go to the table... ->top('#my-table') // Add a couple of empty rows ->append('') // select the rows (both at once) ->children() // Add a CSS class to both rows ->addClass('table-row') // Now just get the first row (at position 0) ->eq(0) // Add a table header in the first row ->append('This is the header') // Now go to the next row ->next() // Add some data to this row ->append('This is the data') // Write it all out as HTML ->writeHTML();