Appendix A: XML and XSLT Functions


This appendix describes various XML and XSLT functions.

XML Functions

Extensible Markup Language (XML) is a standard defined by the World Wide Web consortium (W3C) to represent data in a structured format.

You can use the following functions in Hypertext Preprocessor (PHP) to parse the XML documents:

  • utf8_decode() : Transforms a string encoded in the UTF-8 format to the single-byte ISO-8859-1encoding format. The syntax of the utf8_decode() function is:

     string utf8_decode (string data) 
  • utf8_encode() : Encodes a string with ISO-8859-1 encoding format to the UTF-8 format. The syntax of the utf8_encode() function is:

     string utf8_encode (string data) 
  • xml_error_string() : Returns an XML parser string with a description of the error code, or returns the value, False, if no description is found. The syntax of the xml_error_string() function is:

     string xml_error_string (int error_code) 
  • xml_get_current_byte_index() : Returns the current index of an XML parser. The syntax of the xml_get_current_byte_index() function is:

     int xml_get_current_byte_index (parser) 

In the above syntax, the xml_get_current_byte_index() function returns the value, False, if the specified parser is not a valid parser; or else, returns the current index of an XML parser.

  • xml_get_current_column_number() : Returns the column number the parser is currently at. The syntax of the xml_get_current_column_number() function is:

     int xml_get_current_column_number (parser) 
  • xml_get_current_line_number() : Returns the value of current line number the parser is currently at, in its data buffer. The syntax of the xml_get_current_line_number() function is:

     int xml_get_current_line_number (parser) 
  • xml_parse_into_struct() : Parses the XML data into an array structure. The syntax of the xml_parse_into_struct() function is:

     int xml_parse_into_struct (parser, string data, array &values [, array &index]) 
  • xml_parse() : Parses an XML document. The syntax of the xml_parse() function is:

     bool xml_parse (parserName, string data [, bool final]) 
  • xml_parser_create_ns() : Creates a XML parser with XML namespace support. The syntax of the xml_parser_create_ns() function is:

     resource xml_parser_create_ns ([string encoding [, string separator]]) 
  • xml_parser_create() : Creates an XML parser. The syntax of the xml_parser_create() function is:

     resource xml_parser_create ([string encoding]) 
  • xml_parser_free() : Frees an XML parser and returns the value, False, if the parser is invalid; else, frees the specified parser and returns the value, True. The syntax of the xml_parser_free() function is:

     bool xml_parser_free (resource parser) 
  • xml_parser_get_option() : Returns the value, False, if the specified parser is not a valid parser; else, returns the value of the option that is passed as argument to the xml_parser_get_option() function. The syntax of the xml_parser_get_option() function is:

     mixed xml_parser_get_option (resource parser, int option) 
  • xml_set_character_data_handler() : Sets the character data handler for the specified XML parser. The syntax of the xml_set_character_data_handler() function is:

     bool xml_set_character_data_handler (resource parser, callback handler) 
  • xml_set_default_handler() : Sets the default handler for the specified parser. The syntax of the xml_set_default_handler() is:

     bool xml_set_default_handler (resource parser, callback handler) 
  • xml_set_object() : Lets you use the XML parser within an object. The syntax of the xml_set_object() function is:

     void xml_set_object (resource parser, object object) 
  • xml_set_processing_instruction_handler() : Sets the processing instruction handler for the specified parser. The syntax of the xml_set_processing_instruction_handler() function is:

     bool xml_set_processing_instruction_handler (resource parser, callback handler) 
  • xml_set_start_namespace_decl_handler() : Sets the start namespace declaration handler for the specified parser. The syntax of the xml_set_start_namespace_decl_handler() function is:

     bool xml_set_start_namespace_decl_handler (resource parser, callback handler) 
  • xml_set_unparsed_entity_decl_handler() : Sets the unparsed entity declaration handler for the specified parser. The syntax of the xml_set_unparsed_entity_decl_handler() function is:

     bool xml_set_unparsed_entity_decl_handler (resource parser, callback handler) 



Integrating PHP and XML 2004
Integrating PHP and XML 2004
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 51

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net