# Markup
**Repository Path**: yulin97/Markup
## Basic Information
- **Project Name**: Markup
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-04-30
- **Last Updated**: 2022-04-30
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Markup
![CI][ci badge]
[![Documentation][documentation badge]][documentation]
A Swift package for working with HTML, XML, and other markup languages,
based on [libxml2][libxml2].
**This project is under active development and is not ready for production use.**
## Features
- [x] XML Support
- [x] XHTML4 Support
- [x] XPath Expression Evaluation
- [ ] HTML5 Support (using [Gumbo][gumbo])
- [ ] CSS Selector to XPath Functionality
- [ ] XML Namespace Support
- [ ] DTD and Relax-NG Validation
- [ ] XInclude Support
- [ ] XSLT Support
- [ ] SAX Parser Interface
- [x] HTML and XML Function Builder Interfaces
## Requirements
- Swift 5.1+
- [libxml2][libxml2] _(except for macOS with Xcode 11.4 or later)_
## Usage
### XML
#### Parsing & Introspection
```swift
import XML
let xml = #"""
Hello, world!
"""# let document = try HTML.Document(string: html)! document.body?.children.count // 1 (one element node) document.body?.children.first?.name // "p" document.body?.children.first?.text // "Hello, world!" ``` #### Searching and XPath Expression Evaluation ```swift document.search("/body/p").count // 1 document.search("/body/p").first?.xpath // "/body/p[0]" document.evaluate("/body/p/text()") // .string("Hello, world!") ``` #### Creation and Modification ```swift let div = Element(name: "div") div["class"] = "wrapper" if let p = document.search("/body/p").first { p.wrap(inside: div) } document.body?.description // => /*Hello, world!
## License
MIT
## Contact
Mattt ([@mattt](https://twitter.com/mattt))
[libxml2]: http://xmlsoft.org
[gumbo]: https://github.com/google/gumbo-parser
[ci badge]: https://github.com/SwiftDocOrg/Markup/workflows/CI/badge.svg
[documentation badge]: https://github.com/SwiftDocOrg/Markup/workflows/Documentation/badge.svg
[documentation]: https://github.com/SwiftDocOrg/Markup/wiki