Qore xml Module 1.8.1
Loading...
Searching...
No Matches
Qore::Xml::FileSaxIterator Class Reference

The FileSaxIterator class provides a SAX iterator for file-based XML data based on libxml2 More...

#include <QC_FileSaxIterator.dox.h>

Inheritance diagram for Qore::Xml::FileSaxIterator:
Qore::Xml::SaxIterator

Public Member Methods

 constructor (string path, string element_name, *string encoding)
 creates a new FileSaxIterator object from the file name and the element name passed More...
 
 constructor (string path, string element_name, hash opts)
 creates a new FileSaxIterator object from the file name and the element name passed More...
 
 copy ()
 Returns a copy of the current object (the copy will be reset to the beginning of the XML string) More...
 
- Public Member Methods inherited from Qore::Xml::SaxIterator
 constructor (string xml, string element_name, *hash opts)
 creates a new SaxIterator object from the XML string and element name passed More...
 
 copy ()
 Returns a copy of the current object (the copy will be reset to the beginning of the XML string) More...
 
auto getValue ()
 returns the current value or throws an INVALID-ITERATOR exception if the iterator is invalid More...
 
bool next ()
 Moves the current position to the next element in the XML string; returns False if there are no more elements; if the iterator is not pointing at a valid element before this call, the iterator will be positioned on the first element in the XML if the XML string contains the required element. More...
 
 reset ()
 Reset the iterator instance to its initial state. More...
 
bool valid ()
 returns True if the iterator is currently pointing at a valid element, False if not More...
 

Detailed Description

The FileSaxIterator class provides a SAX iterator for file-based XML data based on libxml2

Member Function Documentation

◆ constructor() [1/2]

Qore::Xml::FileSaxIterator::constructor ( string  path,
string  element_name,
*string  encoding 
)

creates a new FileSaxIterator object from the file name and the element name passed

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
paththe path to a file containing the XML data to iterate
element_namethe name of the element to iterate through
encodingan optional encoding for the file; if not given, then any encoding given in the file's XML preamble is used
Example:
FileSaxIterator i(path, "DetailRecord");
map printf("record %d: %y\n", $#, $1), i;
The FileSaxIterator class provides a SAX iterator for file-based XML data based on libxml2
Definition: QC_FileSaxIterator.dox.h:7
Exceptions
XMLDOC-CONSTRUCTOR-ERRORerror parsing XML string

◆ constructor() [2/2]

Qore::Xml::FileSaxIterator::constructor ( string  path,
string  element_name,
hash  opts 
)

creates a new FileSaxIterator object from the file name and the element name passed

Restrictions:
Qore::PO_NO_FILESYSTEM
Parameters
paththe path to a file containing the XML data to iterate
element_namethe name of the element to iterate through
optsthe following options are accepted:
Example:
FileSaxIterator i(path, "DetailRecord");
map printf("record %d: %y\n", $#, $1), i;
Exceptions
XML-READER-ERRORerror opening file
FILESAXITERATOR-OPTION-ERRORerror in option hash
Since
xml 1.4

◆ copy()

Qore::Xml::FileSaxIterator::copy ( )

Returns a copy of the current object (the copy will be reset to the beginning of the XML string)

Returns
a copy of the current object (the copy will be reset to the beginning of the XML string)
Example:
FileSaxIterator copy = i.copy();
copy()
Returns a copy of the current object (the copy will be reset to the beginning of the XML string)

The documentation for this class was generated from the following file: