Crate oxvg_ast

Crate oxvg_ast 

Source
Expand description

OXVG uses an ast representation of an XML document for processing SVGs.

As opposed to oxvg_collections, which is for the data types of an SVG document, oxvg_ast is for the structural types of an SVG document.

§Types

There are three major types for AST representation

  • node::Node for data nodes of an SVG document.
  • element::Element for a node that contains SVG element data.
  • [attribute::Attribute] for attributes of an SVG element.

§Features

§Parsing

When a parser such as [parse::markup5ever] or [parse::roxmltree] feature flag is enabled, you can bring the respective parsing library and use that to build an OXVG AST representation.

§Visitors

When you enable the visitor feature flag, you can use the visitor::Visitor trait to implement a type that can process each node of the document.

§Serialize

When you enable the serialize feature flag, you can use the serialize::Node method on a node::Node or element::Element in conjunction with xmlwriter::XmlWriter to write an SVG document to a buffer or string.

Modules§

arena
The arena used to allocate nodes
attribute
XML element attribute traits.
class_list
XML DOM token list traits.
document
XML document traits.
element
XML element traits.
error
Error types.
node
XML node traits.
serialize
Functions for serializing XML trees
style
Style and presentation attribute types.
visitor
Visitors for traversing and manipulating nodes of an xml document
xmlwriter
A copy of the xmlwriter create, except with some slight modifications.

Macros§

get_attribute
Gets the given attribute from the crate::element::Element or Attributes
get_attribute_mut
Mutably gets the given attribute from the element
get_computed_style_css
Returns the computed presentation attribute for a computed style
has_attribute
Returns whether the given attribute is on the crate::element::Element or Attributes
has_computed_style_css
Returns whether the computed presentation attribute exists for a computed style
is_attribute
Returns whether the attribute matches the given names
is_element
Returns whether the element matches the given names
remove_attribute
Removes the given attribute from the element
set_attribute
Sets the given attribute to the crate::element::Element or Attributes