xmlReaderNewFromFile

SYNOPSIS

xmlReader xmlReaderNewFromFile(string filename
                                   [, string encoding ]
                                   [, string options  ] )

Parameters:

  • filename - the name of the XML file you'd like to read

  • encoding (optional) - encoding to use for the file. If none given, xmlReader will attempt to discover on its own.

  • options (optional) - a comma-separated list of parsing options (see below)

Returns:

  • the xmlReader for this file


DESCRIPTION
xmlReaderNewFromFile() opens a new xmlReader on the filename specified. The entire XML file is not read when the xmlReader is opened, allowing for larger files to be read without loading them entirely in memory.

The possible values for the options parameter are:

  • XML_PARSE_RECOVER - recover on errors

  • XML_PARSE_NOENT - substitute entities

  • XML_PARSE_DTDLOAD - load the external subset

  • XML_PARSE_DTDATTR - default DTD attributes

  • XML_PARSE_DTDVALID - validate with the DTD

  • XML_PARSE_NOERROR - suppress error reports

  • XML_PARSE_NOWARNING - suppress warning reports

  • XML_PARSE_PEDANTIC - pedantic error reporting

  • XML_PARSE_NOBLANKS - remove blank nodes

  • XML_PARSE_XINCLUDE - Implement XInclude substitution

  • XML_PARSE_NONET - Forbid network access

  • XML_PARSE_NSCLEAN - remove redundant namespaces declarations

  • XML_PARSE_NOCDATA - merge CDATA as text nodes

  • XML_PARSE_NOXINCNODE - do not generate XINCLUDE START/END nodes


EXAMPLE

<!-- read the file, but ignore blank text nodes
      == and load the DTD (as long as it doesn't
      == involve a network fetch). -->
    <$reader = (xmlReaderNewFromFile($filename,
'XML_PARSE_NOBLANKS, XML_PARSE_DTDLOAD, XML_PARSE_NONET'))>


SEE ALSO
xmlReaderNewFromString


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.