Giter VIP home page Giter VIP logo

xml-nodes's Introduction

xml-nodes

Build Status

NPM

Streaming XML node splitter

Have a large XML file and only interesting in one type of tag? xml-nodes accepts a tag name and returns a stream which emits each tag as a string.

Install

With npm do:

npm install xml-nodes

Example

var request = require('request')
var xmlNodes = require('xml-nodes')

request('http://news.yahoo.com/rss/entertainment')
  .pipe(xmlNodes('item'))
  .pipe(process.stdout)

License

MIT

xml-nodes's People

Contributors

timhudson avatar

Stargazers

devin ivy avatar Pawel Otto avatar Emerson P. Gomes avatar

Watchers

 avatar Dan Flettre avatar James Cloos avatar

xml-nodes's Issues

Need to account for nested tags

When the tag we are looking for contains the same tag inside it we spit out partial data.

Example input:

<article>
  <item>
    <article></article>
  </item>
</article>

Example output:

<article>
  <item>
    <article></article>

Chokes on "/" in attribute values?

Hi, i was very happy to find this, and it all went pretty dandy until it didn't.

The source of the problem seems to be forward slashed in attribute values.

Quick example:

<ifapRohdaten>
    <Anbieter AnbieterID="8141" Firmenname="1 Alpha Pharma GmbH" Land="Deutschland" Ort="Kaiserslautern" PLZ="67663"
              Strasse="Kohlenhofstr. 10" Telefon="0631 3038893" Fax="0631 3039601" EMail="[email protected]"
              URL="www.1alphapharma.de"/>
    <Anbieter AnbieterID="11965" Firmenname="HEXAL AG" Land="Deutschland" Ort="Holzkirchen" PLZ="83607"
              Strasse="Industriestr. 25" Telefon="0800/4392527" Fax="0800/4392532" EMail="" URL=""/>
    <Anbieter AnbieterID="13590" Firmenname="Infectopharm Arzn.U.Consilium GmbH" Land="Deutschland" Ort="Heppenheim"
              PLZ="64646" Strasse="Von-Humboldt-Str. 1" Telefon="06252 957000" Fax="06252 958844"
              EMail="[email protected]" URL="www.infectopharm.com"/>
</ifapRohdaten>

I parse for "Anbieter" nodes. The library stops calling the data callbacks when arriving at the second node (in this example, I was working with more nodes in my program).

This seems to be due to the forward slash in the Telefon= and Fax= - fields, which unfortunately is pretty common in the german speaking parts of Europe.

Anyhow, I thought I'd let you know. Maybe it's the self closing tags parser? I am not sure, but I thought I'd give you a heads up.

Thanks and bye

Daniel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.