SwiftDocOrg / Markup
Licence: mit
A Swift package for working with HTML, XML, and other markup languages, based on libxml2.
Stars: ✭ 93
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Markup
Jsoup
jsoup: the Java HTML parser, built for HTML editing, cleaning, scraping, and XSS safety.
Stars: ✭ 9,184 (+9775.27%)
Mutual labels: xml, xpath
Parsel
Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors
Stars: ✭ 628 (+575.27%)
Mutual labels: xml, xpath
Xpath
XPath package for Golang, supports HTML, XML, JSON document query.
Stars: ✭ 376 (+304.3%)
Mutual labels: xml, xpath
Exist
eXist Native XML Database and Application Platform
Stars: ✭ 294 (+216.13%)
Mutual labels: xml, xpath
Ono
A sensible way to deal with XML & HTML for iOS & macOS
Stars: ✭ 2,599 (+2694.62%)
Mutual labels: xml, xpath
Amazon Mobile Sentiment Analysis
Opinion mining of Mobile reviews on Amazon platform
Stars: ✭ 19 (-79.57%)
Mutual labels: xml, xpath
Fuzi
A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
Stars: ✭ 894 (+861.29%)
Mutual labels: xml, xpath
XPathTools
A Visual Studio Extension which can run any XPath and XPath function; navigates through results at the click of a button. Can show and copy any XPath incl. XML namespaces, avoiding XML namespace induced headaches. Keeps track of the current XPath via the statusbar.
Stars: ✭ 40 (-56.99%)
Mutual labels: xml, xpath
Internettools
XPath/XQuery 3.1 interpreter for Pascal with compatibility modes for XPath 2.0/XQuery 1.0/3.0, custom and JSONiq extensions, XML/HTML parsers and classes for HTTP/S requests
Stars: ✭ 82 (-11.83%)
Mutual labels: xml, xpath
Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (+260.22%)
Mutual labels: xml, xpath
Meeseeks
An Elixir library for parsing and extracting data from HTML and XML with CSS or XPath selectors.
Stars: ✭ 252 (+170.97%)
Mutual labels: xml, xpath
Camaro
camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser pugixml, one of the fastest XML parser around.
Stars: ✭ 438 (+370.97%)
Mutual labels: xml, xpath
Xmlquery
xmlquery is Golang XPath package for XML query.
Stars: ✭ 209 (+124.73%)
Mutual labels: xml, xpath
Pugixml
Light-weight, simple and fast XML parser for C++ with XPath support
Stars: ✭ 2,809 (+2920.43%)
Mutual labels: xml, xpath
Sirix
SirixDB is a temporal, evolutionary database system, which uses an accumulate only approach. It keeps the full history of each resource. Every commit stores a space-efficient snapshot through structural sharing. It is log-structured and never overwrites data. SirixDB uses a novel page-level versioning approach called sliding snapshot.
Stars: ✭ 638 (+586.02%)
Mutual labels: xml, xpath
Xom
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance, in that order.
Stars: ✭ 38 (-59.14%)
Mutual labels: xml, xpath
Markup
A Swift package for working with HTML, XML, and other markup languages, based on 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)
- [ ] CSS Selector to XPath Functionality*
- [ ] XML Namespace Support*
- [ ] DTD and Relax-NG Validation*
- [ ] XInclude Support*
- [ ] XSLT Support*
- [ ] SAX Parser Interface*
- [ ] HTML and XML Function Builder Interfaces*
* Coming soon!
Requirements
- Swift 5.1+
- libxml2 (except for macOS with Xcode 11.4 or later)
Usage
XML
Parsing & Introspection
import XML
let xml = #"""
<?xml version="1.0" encoding="UTF-8"?>
<!-- begin greeting -->
<greeting>Hello!</greeting>
<!-- end greeting -->
"""#
let document = try XML.Document(string: xml)!
document.root?.name // "greeting"
document.root?.content // "Hello!"
document.children.count // 3 (two comment nodes and one element node)
document.root?.children.count // 1 (one text node)
Searching and XPath Expression Evaluation
document.search("//greeting").count // 1
document.evaluate("//greeting/text()") // .string("Hello!")
Modification
for case let comment as Comment in document.children {
comment.remove()
}
document.root?.name = "valediction"
document.root?["lang"] = "it"
document.root?.content = "Arrivederci!"
document.description // =>
/*
<?xml version="1.0" encoding="UTF-8"?>
<valediction lang="it">Arrivederci!</valediction>
*/
HTML
Parsing & Introspection
import HTML
let html = #"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
"""#
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
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
let div = Element(name: "div")
div["class"] = "wrapper"
if let p = document.search("/body/p").first {
p.wrap(inside: div)
}
document.body?.description // =>
/*
<div class="wrapper">
<p>Hello, world!</p>
</div>
*/
Installation
Swift Package Manager
If you're on Linux or if you're on macOS and using Xcode < 11.4, install the libxml2 system library:
# macOS for Xcode 11.3 and earlier
$ brew install libxml2
$ brew link --force libxml2
# Linux (Ubuntu)
$ sudo apt-get install libxml2-dev
Add the Markup package to your target dependencies in Package.swift
:
import PackageDescription
let package = Package(
name: "YourProject",
dependencies: [
.package(
url: "https://github.com/SwiftDocOrg/Markup",
from: "0.0.1"
),
]
)
Add Markup
as a dependency to your target(s):
targets: [
.target(
name: "YourTarget",
dependencies: ["Markup"]),
License
MIT
Contact
Mattt (@mattt)
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].