Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@passport-js/xtraverse

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@passport-js/xtraverse

Wrapper for simplifying XML traversal.

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
665
increased by20.91%
Maintainers
1
Weekly downloads
 
Created
Source

xtraverse

Build Coverage Dependencies

Simplified traversal and building of an XML DOM.

This module provides a jQuery-like wrapper, but geared for traversing and manipulating an XML DOM, as opposeed to an HTML DOM. The API aims to be compatible with Strophe.js' Builder and Less-Than XML. The underlying DOM is W3C standard, provided by XMLDOM.

Install

$ npm install xtraverse

Usage

Parse XML
var xml = fs.readFileSync('feed.xml', 'utf8');
var feed = XT(xml);
Traverse XML
console.log(feed.children('title').text());
for (var link = feed.children().first('link'); link.length > 0; link = link.next('link')) {
  console.log(link.attr('href'));
}
for (var entry = feed.children().first('entry'); entry.length > 0; entry = entry.next('entry')) {
  console.log('Entry: ' + entry.children('title').text());
}
Build XML
var feed = XT('<feed xmlns="http://www.w3.org/2005/Atom"/>')
  .c('title').t('Example Feed').up()
  .c('link', { href: 'http://example.org/' })
  .c('entry').c('title').t('Atom-Powered Robots Run Amok').up().up()
  .c('entry').c('title').t('Today I Ate Pancakes');

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2013 Jared Hanson <http://jaredhanson.net/>

Keywords

FAQs

Package last updated on 30 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc