Skip to main content

Module reader

Module reader 

Source
Expand description

XML Reader API (§30, §85 Phase 7).

Cursor-based streaming reader with node type, depth, attribute traversal, namespace lookup, value retrieval, validation integration.

Implements the xmlTextReader API from libxml2, which provides a cursor-based streaming interface for reading XML documents. The reader parses the entire document into a tree on the first Read() call, then walks the tree in document order (depth-first traversal) generating node events for elements, text, comments, PIs, etc.

§UPSTREAM-PARITY

The reader API is defined in libxml/xmlreader.h and libxml/xmlreader.c. Key differences from upstream:

  • The reader parses the full document on first Read rather than using a true streaming/event-driven parser. This simplifies the implementation while preserving the observable API surface.
  • Pattern-based reader operations (xmlTextReaderPreservePattern, etc.) are not yet implemented.

Functions§

xmlFreeTextReader
Free a text reader.
xmlNewTextReader
Create a new text reader from an input buffer.
xmlReaderForFd
Create a text reader from a file descriptor.
xmlReaderForFile
Create a text reader for a file.
xmlReaderForIO
Create a text reader from I/O callbacks.
xmlReaderForMemory
Create a text reader from memory.
xmlTextReaderAttributeCount
Get the attribute count of the current element.
xmlTextReaderBaseUri
Get the base URI of the current node.
xmlTextReaderConstName
Get a constant pointer to the name (no copy).
xmlTextReaderConstValue
Get a constant pointer to the value (no copy).
xmlTextReaderCurrentDoc
Get the current document from the reader.
xmlTextReaderDepth
Get the depth of the current node.
xmlTextReaderGetAttribute
Get an attribute value by name.
xmlTextReaderGetAttributeNo
Get an attribute value by index.
xmlTextReaderGetAttributeNs
Get an attribute value by local name and namespace URI.
xmlTextReaderGetParserProp
Get a parser property.
xmlTextReaderHasAttributes
Check if the current node has attributes.
xmlTextReaderHasValue
Check if the current node has a value.
xmlTextReaderIsEmptyElement
Check if the current element is an empty element (no children).
xmlTextReaderLocalName
Get the local name of the current node.
xmlTextReaderLookupNamespace
Look up a namespace by prefix.
xmlTextReaderMoveToAttribute
Move to an attribute by name.
xmlTextReaderMoveToAttributeNo
Move to an attribute by index.
xmlTextReaderMoveToElement
Move the reader back to the parent element (from an attribute).
xmlTextReaderMoveToFirstAttribute
Move to the first attribute of the current element.
xmlTextReaderMoveToNextAttribute
Move to the next attribute.
xmlTextReaderName
Get the name of the current node.
xmlTextReaderNamespaceUri
Get the namespace URI of the current node.
xmlTextReaderNext
Skip to the next sibling of the current node.
xmlTextReaderNextSibling
Skip to the next sibling (same as xmlTextReaderNext).
xmlTextReaderNodeType
Get the node type of the current node.
xmlTextReaderPrefix
Get the prefix of the current node.
xmlTextReaderPrev
Skip to the previous sibling of the current node.
xmlTextReaderRead
Advance the reader to the next node in document order.
xmlTextReaderReadState
Get the read state.
xmlTextReaderSetParserProp
Set a parser property.
xmlTextReaderSetup
Setup/reinitialize a reader with new input.
xmlTextReaderValue
Get the value of the current node.