Skip to main content

Crate marxml

Crate marxml 

Source
Expand description

§marxml

Fast markdown + XML query, mutation, validation, and serialization. Rust core for the marxml ecosystem. See https://github.com/thebytefarm/marxml.

The crate exposes:

let doc = marxml::parse("<task id=\"1\">hello</task>")?;
assert_eq!(doc.root_count(), 1);

Re-exports§

pub use schema::AttrConstraint;
pub use schema::AttrKind;
pub use schema::Schema;
pub use schema::SchemaBuilder;
pub use schema::SchemaError;
pub use schema::TagBuilder;

Modules§

schema
Declarative schema for validating parsed documents.

Structs§

ElementRef
A cheap reference to a parsed element, borrowing from the owning Markdown document.
Markdown
A parsed markdown + embedded XML document.
MutationReport
Outcome of a successful mutation. Reports both the rewritten document and any accounting useful for diagnostics.
Selector
A compiled CSS-subset selector.
SerializeOpts
Options for Markdown::to_xml.
SourcePosition
A position in the source document.
SourceSpan
A half-open span of source positions: [start, end).
ValidationReport
Outcome of validate.

Enums§

MutateError
Errors returned by the fallible mutation variants.
ParseError
Errors returned from crate::parse and crate::parse_fragment.
SelectorError
An error returned when a selector string fails to parse.
ValidationError
One problem found during validation. Every variant carries a 1-based line number and the offending tag for diagnostic output.

Constants§

MAX_DEPTH
Maximum depth of element nesting accepted by the parser.
MAX_INPUT_BYTES
Maximum byte length of input accepted by the parser.
VERSION
Crate version exposed for downstream diagnostics.

Functions§

escape_attr
Escape value for use inside a double-quoted XML attribute literal.
escape_text
Escape value for use as XML text content.
is_valid_name
true when name is a syntactically valid XML name as recognized by the rest of the crate (non-empty, starts with a name-start byte, every subsequent byte is a name-char).
parse
Parse a full markdown+XML document.
parse_fragment
Parse a fragment.
parse_owned
Parse a document, moving in the owned source string instead of cloning it. Use this when you already own a String and want to avoid the allocation that parse would do internally.
validate
Validate every element in doc whose tag is named in schema.