Add PureXML.XPath: a compiled location-path query engine reimplemented from the XPath 1.0 specification; no upstream code copied. - Compiler parses a path into steps; Evaluator walks the tree returning a Selection node-set (node or attribute) in document order. - Forward axes only (child, descendant //, self ., attribute @), since the value model has no parent pointers. Node tests: name, *, text(), node(), comment(). Predicates: [n], [@a], [@a='v'], [child], [child='v']. - Public surface: XPath.Query (init compiles, evaluate/elements/strings), the Selection enum (element / stringValue), QueryError, and the one-shot PureXML.xpath(_:over:). Upward/sibling axes and the full expression language are explicitly out of scope. - 12 XPath tests; 61 total.
27 lines
532 B
Swift
27 lines
532 B
Swift
/// Root namespace for the PureXML package.
|
|
public enum PureXML {
|
|
/// XML document model types.
|
|
public enum Model {}
|
|
|
|
/// XML parsing types.
|
|
public enum Parsing {}
|
|
|
|
/// XML emitting types.
|
|
public enum Emitting {}
|
|
|
|
/// XML typed decoding types.
|
|
public enum Decoding {}
|
|
|
|
/// XML typed encoding types.
|
|
public enum Encoding {}
|
|
|
|
/// XML validation types.
|
|
public enum Validation {}
|
|
|
|
/// XML stream types.
|
|
public enum Stream {}
|
|
|
|
/// XPath query types.
|
|
public enum XPath {}
|
|
}
|