How to use @rgrove/parse-xml - 2 common examples

To help you get started, we’ve selected a few @rgrove/parse-xml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-R / reactR / js-tests / js-tests.jsx View on Github external
function stringToTag(str) {
    return objectToTag(parseXml(str).children[0]);
}
github ant-design / ant-design-icons / packages / icons-svg / plugins / icon-definition.ts View on Github external
return through.obj(function(file: File, encoding, done) {
    if (file.isBuffer()) {
      const before = file.contents.toString(encoding);
      const XMLTree: XMLNode = parseXML(before);
      const XMLRootNode =
        XMLTree.type === 'document'
          ? (XMLTree.children[0] as XMLNode)
          : XMLTree;

      const iconName = file.stem;
      const abstractRootNode = toAbstractNode(XMLRootNode, iconName);
      const iconDefinitionBaseNode: IconDefinitionBase = {
        name: iconName,
        theme,
        icon: abstractRootNode
      };

      const icond = stringify(iconDefinitionBaseNode);
      file.contents = Buffer.from(icond);
      done(null, file);

@rgrove/parse-xml

A fast, safe, compliant XML parser for Node.js and browsers.

ISC
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis

Popular @rgrove/parse-xml functions