Package Exports
- xml-fns
- xml-fns/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xml-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
xml-fns
Higher Level XML Utility Functions
install
npm install xml-fnsusage
findTagText
import { findTagText } from "xml-fns/findTagText.js"
const xml = `
<item>
<title>
My Article
</title>
</item>
`;
// by tag name
findTagText(xml, "title"); // "My Article"hasTag
import { hasTag } from "xml-fns/hasTag.js"
const xml = `
<item>
<title>My Article</title>
</item>
`;
// by tag name
hasTag(xml, "title"); // true
// by tag path
hasTag(xml, ["item", "title"]); // truehasAllTags
import { hasAllTags } from "xml-fns/hasAllTags.js"
const xml = `
<item>
<title>My Article</title>
<geo:lat>5.5319</geo:lat>
<geo:long>95.8972</geo:long>
</item>
`;
// by tag names
hasAllTags(xml, ["geo:lat", "geo:long"]); // true
// by tag paths
hasAllTags(xml, [["item", "geo:lat"], ["item", "geo:long"]]); // true