fop_core/lib.rs
1//! Core FO tree parsing and property system for Apache FOP
2//!
3//! This crate provides the foundational components for parsing XSL-FO documents
4//! and building the Formatting Object tree.
5//!
6//! # Features
7//!
8//! - **294 XSL-FO 1.1 properties** with type-safe enums
9//! - **Property inheritance** with caching for performance
10//! - **Arena-allocated tree** for zero-overhead node handles
11//! - **SAX-like parsing** for streaming XML processing
12//! - **29 FO element types** covering layout, blocks, tables, lists
13//! - **Shorthand expansion** for margin, padding, border properties
14//! - **Element nesting validation** per XSL-FO 1.1 spec
15//!
16//! # Quick Start
17//!
18//! ```no_run
19//! use fop_core::FoTreeBuilder;
20//! use std::io::Cursor;
21//!
22//! let xml = r#"<?xml version="1.0"?>
23//! <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
24//! <fo:layout-master-set>
25//! <fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm">
26//! <fo:region-body margin="1in"/>
27//! </fo:simple-page-master>
28//! </fo:layout-master-set>
29//! <fo:page-sequence master-reference="A4">
30//! <fo:flow flow-name="xsl-region-body">
31//! <fo:block font-size="14pt">Hello, FOP!</fo:block>
32//! </fo:flow>
33//! </fo:page-sequence>
34//! </fo:root>"#;
35//!
36//! let builder = FoTreeBuilder::new();
37//! let arena = builder.parse(Cursor::new(xml)).unwrap();
38//!
39//! for (id, node) in arena.iter() {
40//! println!("{}: {}", id, node.data.element_name());
41//! }
42//! ```
43//!
44//! # Architecture
45//!
46//! The crate is organized into several modules:
47//!
48//! - [`properties`] - Property system (IDs, values, lists, inheritance)
49//! - [`tree`] - FO tree structure (arena, nodes, builder)
50//! - [`xml`] - XML parsing utilities (parser, namespaces)
51
52pub mod properties;
53pub mod tree;
54pub mod xml;
55
56pub use fop_types::{
57 Color, ColorStop, FopError, Gradient, Length, Percentage, Point, Rect, Result, Size,
58};
59pub use properties::{
60 PropertyId, PropertyList, PropertyValidator, PropertyValue, RelativeFontSize, ShorthandExpander,
61};
62pub use tree::{FoArena, FoNode, FoNodeData, FoTreeBuilder, IdRegistry, NestingValidator, NodeId};
63pub use xml::{Namespace, XmlParser};