Expand description
Core FO tree parsing and property system for Apache FOP
This crate provides the foundational components for parsing XSL-FO documents and building the Formatting Object tree.
§Features
- 294 XSL-FO 1.1 properties with type-safe enums
- Property inheritance with caching for performance
- Arena-allocated tree for zero-overhead node handles
- SAX-like parsing for streaming XML processing
- 29 FO element types covering layout, blocks, tables, lists
- Shorthand expansion for margin, padding, border properties
- Element nesting validation per XSL-FO 1.1 spec
§Quick Start
use fop_core::FoTreeBuilder;
use std::io::Cursor;
let xml = r#"<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="14pt">Hello, FOP!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>"#;
let builder = FoTreeBuilder::new();
let arena = builder.parse(Cursor::new(xml)).unwrap();
for (id, node) in arena.iter() {
println!("{}: {}", id, node.data.element_name());
}§Architecture
The crate is organized into several modules:
properties- Property system (IDs, values, lists, inheritance)tree- FO tree structure (arena, nodes, builder)xml- XML parsing utilities (parser, namespaces)
Re-exports§
pub use properties::PropertyId;pub use properties::PropertyList;pub use properties::PropertyValidator;pub use properties::PropertyValue;pub use properties::RelativeFontSize;pub use properties::ShorthandExpander;pub use tree::FoArena;pub use tree::FoNode;pub use tree::FoNodeData;pub use tree::FoTreeBuilder;pub use tree::IdRegistry;pub use tree::NestingValidator;pub use tree::NodeId;pub use xml::Namespace;pub use xml::XmlParser;
Modules§
- properties
- Property system for XSL-FO
- tree
- FO tree data structures
- xml
- XML parsing utilities for XSL-FO documents
Structs§
- Color
- RGBA color value
- Color
Stop - Color stop in a gradient
- Length
- Length measurement stored as millipoints (1/1000 point)
- Percentage
- A percentage value stored as a fraction
- Point
- A 2D point with x and y coordinates
- Rect
- A rectangle defined by position and size
- Size
- A 2D size with width and height
Enums§
Type Aliases§
- Result
- Result type alias for FOP operations