| |
A1:
| You can get a parser resource with the xml_parser_create() function, like so:
$parser = xml_parser_create();
|
| |
A2:
| The user-defined element start handler function automatically is passed a parser resource, the name of the element which is starting, and an array of attributes. |
| |
A3:
| You can use the xml_parser_set_option() function to disable case folding, like so:
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
|
| |
A4:
| The xml_get_current_line_number() function returns the current line number. |
| |
A5:
| You can instantiate a DomDocument object directly using the new keyword. You can then use the loadXML() method to import XML from a file. Here's how:
$xml_doc = new DomDocument ("1.0" );
$xml_doc->loadXML( file_get_contents("./listing22.1.xml") );
|
| |
A6:
| You can use the appendChild() method to add an element to a tree of objects, as shown here:
$doc = new DomDocument();
$rootel = $doc->createElement("banana-news");
$doc->appendChild( $rootel );
|
| |
A7:
| The XsltProcessor class returns an object that can be used to process XSLT. |