Socket
Socket
Sign inDemoInstall

xml-parser

Package Overview
Dependencies
1
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.1.0

benchmark/index.js

7

index.js

@@ -83,3 +83,3 @@

// attributes
while (!(eos() || is('>') || is('?>'))) {
while (!(eos() || is('>') || is('?>') || is('/>'))) {
var attr = attribute();

@@ -90,2 +90,7 @@ if (!attr) return node;

// self closing tag
if (match(/^\s*\/>\s*/)) {
return node;
}
match(/\??>\s*/);

@@ -92,0 +97,0 @@

5

package.json
{
"name": "xml-parser",
"version": "0.0.1",
"version": "0.1.0",
"repository": "segmentio/xml-parser",

@@ -15,5 +15,6 @@ "description": "the little xml parser that could",

"mocha": "*",
"should": "*"
"should": "*",
"matcha": "~0.4.1"
},
"license": "MIT"
}
# xml-parser
Simple non-compiant XML parser because we just need to parse some basic responses and libxml takes forever to compile ;D
Simple non-compiant XML parser because we just need to parse some basic responses and libxml takes forever to compile :D you probably don't want to use this unless you also have similar needs.

@@ -6,0 +6,0 @@ ## Installation

@@ -123,1 +123,58 @@

it('should support self-closing tags', function () {
var node = parse('<a><b>foo</b><b a="bar" /><b>bar</b></a>');
node.root.should.eql({
"name": "a",
"attributes": {},
"children": [
{
"name": "b",
"attributes": {},
"children": [],
"content": "foo"
},
{
"name": "b",
"attributes": {
"a": "bar"
},
"children": []
},
{
"name": "b",
"attributes": {},
"children": [],
"content": "bar"
}
],
"content": ""
})
})
it('should support self-closing tags without attributes', function () {
var node = parse('<a><b>foo</b><b /> <b>bar</b></a>');
node.root.should.eql({
"name": "a",
"attributes": {},
"children": [
{
"name": "b",
"attributes": {},
"children": [],
"content": "foo"
},
{
"name": "b",
"attributes": {},
"children": []
},
{
"name": "b",
"attributes": {},
"children": [],
"content": "bar"
}
],
"content": ""
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc