Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unable to make use of processing attribute stripPrefix of node-xml2js library #99

Open
@theasteve

Description

I'm a bit confused by the documentation and am willing to create a PR to improve it once I have a better understanding of the following. In https://github.com/bobby-brennan/rss-parser#xml2js-passthrough states that you can pass options to xml2js parser. I have the following:

const parser = new Parser({
 xml2js: {
 stripPrefix: "xmlns:event"
 },
});

I would like to make use of stripPrefix of the xml2js library. It still a bit confusing to me how to use xml2js from the documentation. This new xml2js.Parser() as shown in the docs won't work. What I am tryin to accomplish is to get the namespace fields.

screen shot 2019年03月01日 at 1 42 55 pm

from event a more descriptive image would be shown below:
screen shot 2019年02月27日 at 11 31 18 am

However, when I try to console.log each item from the following function:

const convertRssIntoJson = rssFeed => {
 return new Promise((res, rej) => {
 parser.parseURL(rssFeed, (err, rss) => {
 if (err) {
 return rej(err);
 }
 // console.log(rss.stripPrefix()) is this how is use?
 rss.items.forEach(function(entry) {
 console.log(entry);
 });
 return res(rss);
 });
 });
};

I dont get the namespace fields from event. I would like to get those fields in the JSON without having to add customFields. How can I make use of stripPrefix option an use xml2js?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /