Skip to main content

XmlTextReader

Struct XmlTextReader 

Source
pub struct XmlTextReader { /* private fields */ }

Implementations§

Source§

impl XmlTextReader

Source

pub unsafe fn Read(&mut self) -> c_int

Read the next node in document order.

Returns 1 if a node was read, 0 if no more nodes (EOF), -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn Next(&mut self) -> c_int

Skip to the next sibling of the current node.

Returns 1 on success, 0 if no more siblings, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn MoveToElement(&mut self) -> c_int

Move to the parent element (if currently on an attribute).

Returns 1 on success, 0 if not on an attribute, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn MoveToAttribute(&mut self, name: *const xmlChar) -> c_int

Move to an attribute by name.

Returns 1 on success, 0 if attribute not found, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn MoveToAttributeNo(&mut self, index: c_int) -> c_int

Move to an attribute by index.

Returns 1 on success, 0 if index out of range, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn MoveToFirstAttribute(&mut self) -> c_int

Move to the first attribute of the current element.

Returns 1 on success, 0 if no attributes, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn MoveToNextAttribute(&mut self) -> c_int

Move to the next attribute.

Returns 1 on success, 0 if no more attributes, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn Prev(&mut self) -> c_int

Move to the previous sibling.

Returns 1 on success, 0 if no previous sibling, -1 on error.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub const fn Depth(&self) -> c_int

Get the depth of the current node.

Source

pub const fn NodeType(&self) -> ReaderNodeType

Get the node type of the current node.

Source

pub unsafe fn Name(&self) -> *mut xmlChar

Get the name of the current node.

Returns a pointer to a newly allocated string (caller must free with xmlFree), or NULL if there is no name.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn Value(&self) -> *mut xmlChar

Get the value of the current node.

Returns a pointer to a newly allocated string (caller must free with xmlFree), or NULL if there is no value.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub const fn ConstName(&self) -> *const xmlChar

Get a constant pointer to the name (no copy).

The returned pointer is valid only while the reader is alive and positioned on the same node.

Source

pub const fn ConstValue(&self) -> *const xmlChar

Get a constant pointer to the value (no copy).

The returned pointer is valid only while the reader is alive and positioned on the same node.

Source

pub const fn HasValue(&self) -> c_int

Check if the current node has a value.

Source

pub fn HasAttributes(&self) -> c_int

Check if the current node has attributes.

Source

pub fn IsEmptyElement(&self) -> c_int

Check if the current element is an empty element (no children).

Source

pub unsafe fn BaseUri(&self) -> *mut xmlChar

Get the base URI of the current node.

Returns a newly allocated string (caller must free with xmlFree), or NULL if not available.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn LocalName(&self) -> *mut xmlChar

Get the local name of the current node.

For namespaced names, this strips the prefix. Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn NamespaceUri(&self) -> *mut xmlChar

Get the namespace URI of the current node.

Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn Prefix(&self) -> *mut xmlChar

Get the prefix of the current node.

Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub const fn AttributeCount(&self) -> c_int

Get the attribute count of the current element.

Source

pub const fn ReadState(&self) -> ReadState

Get the read state.

Source

pub unsafe fn GetAttribute(&self, name: *const xmlChar) -> *mut xmlChar

Get an attribute value by name.

Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn GetAttributeNo(&self, index: c_int) -> *mut xmlChar

Get an attribute value by index.

Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn GetAttributeNs( &self, localName: *const xmlChar, namespaceURI: *const xmlChar, ) -> *mut xmlChar

Get an attribute value by local name and namespace URI.

Returns a newly allocated string, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub unsafe fn LookupNamespace(&self, prefix: *const xmlChar) -> *mut xmlChar

Look up a namespace by prefix.

Returns a newly allocated string with the namespace URI, or NULL.

§SAFETY

self must be a valid XmlTextReader obtained from a reader constructor (xmlReaderForDoc/xmlReaderForFile/xmlReaderForMemory/ xmlReaderForIO or xmlNewTextReader) and not yet closed or freed. The &mut self borrow excludes concurrent access from other threads. Pointers returned by this method are valid only until the next traversal operation invalidates them, per the C API contract.

Source

pub const fn GetParserProp(&self, prop: c_int) -> c_int

Get a parser property.

Source

pub const fn SetParserProp(&mut self, prop: c_int, value: c_int) -> c_int

Set a parser property.

Source

pub const fn CurrentDoc(&self) -> *mut _xmlDoc

Get the current document.

Trait Implementations§

Source§

impl Debug for XmlTextReader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for XmlTextReader

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.