29 #ifndef Pt_Xml_XmlReader_h
30 #define Pt_Xml_XmlReader_h
32 #include <Pt/Xml/Api.h>
33 #include <Pt/Xml/Node.h>
34 #include <Pt/String.h>
35 #include <Pt/NonCopyable.h>
43 class DocTypeDefinition;
214 class XmlReaderImpl* _impl;
217 XmlReaderImpl* impl()
238 { _node = &_stream->
get(); }
243 : _stream(it._stream), _node(it._node)
255 _stream = it._stream;
274 if(_node->
type() == Node::EndDocument)
277 _node = &_stream->
next();
285 {
return _node == it._node; }
290 {
return _node != it._node; }
313 #endif // Pt_Xml_XmlReader_h
Core module.
Definition: Allocator.h:33
Resolves external entities and DTDs.
Definition: XmlResolver.h:54
InputSource * input()
Returns the current input source or nullptr if none is set.
Node * advance()
Process availabe data from underlying input source.
Reads XML as a Stream of XML Nodes.
Definition: XmlReader.h:80
XmlReader()
Default Constructor.
XmlResolver * resolver() const
Returns the resolver or nullptr is none was set.
Node & get()
Get current node.
void reportStartDocument(bool value)
Configures the parser to report the start of the document.
InputIterator end() const
Returns an iterator to the end of the document.
Definition: XmlReader.h:304
void reset(InputSource &is)
Starts parsing with an input source.
Node & next()
Get next node.
XmlReader(XmlResolver &r, InputSource &is)
Construct with resolver and input source.
std::size_t depth() const
Returns the XML tree depth.
InputIterator current()
Returns an iterator to the current node.
Definition: XmlReader.h:298
void reset()
Clears the reader state and input.
XML document node.
Definition: Node.h:51
Type type() const
Returns the type of the node.
Definition: Node.h:74
void setMaxSize(std::size_t n)
Sets the max number of characters the parser may allocate.
void setMaxInputDepth(std::size_t n)
Sets the max expansion depth of input sources.
void setChunkSize(std::size_t n)
Sets the max size of a characters block.
std::size_t line() const
Returns the current line of the primary input source.
DocTypeDefinition & dtd()
Returns current DTD of the document.
void addInput(InputSource &in)
Adds an external input source.
std::size_t maxSize() const
Returns the number of characters the parser may allocate.
void reportComments(bool value)
Configures the parser to report comments.
const DocTypeDefinition & dtd() const
Returns current DTD of the document.
Protects derived classes from being copied.
Definition: NonCopyable.h:54
The DocTypeDefinition of an XML document.
Definition: DocTypeDefinition.h:58
XmlReader(InputSource &is)
Construct with input source.
void reportEntityReferences(bool value)
Configures the parser to report entity references.
std::size_t usedSize() const
Returns the number of characters the parser has allocated.
void reportProcessingInstructions(bool value)
Configures the parser to report processing instructions.
void reportCData(bool value)
Configures the parser to report CDATA sections.
void reportDocType(bool value)
Configures the parser to report DOCTYPEs.