xml-parser

WebJar for xml-parser

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

xml-parser
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

xml-parser
WebJar for xml-parser
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/segmentio/xml-parser

Download xml-parser

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/xml-parser/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>xml-parser</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/xml-parser/
implementation 'org.webjars.npm:xml-parser:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/xml-parser/
implementation ("org.webjars.npm:xml-parser:1.2.1")
'org.webjars.npm:xml-parser:jar:1.2.1'
<dependency org="org.webjars.npm" name="xml-parser" rev="1.2.1">
  <artifact name="xml-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='xml-parser', version='1.2.1')
)
libraryDependencies += "org.webjars.npm" % "xml-parser" % "1.2.1"
[org.webjars.npm/xml-parser "1.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : debug jar [2.2.0,3)

Project Modules

There are no modules declared in this project.

xml-parser

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.

Installation

$ npm install xml-parser

Example

JavaScript:

var fs = require('fs');
var parse = require('xml-parser');
var xml = fs.readFileSync('examples/developerforce.xml', 'utf8');
var inspect = require('util').inspect;

var obj = parse(xml);
console.log(inspect(obj, { colors: true, depth: Infinity }));

XML:

<?xml version="1.0" encoding="utf-8"?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns="urn:enterprise.soap.sforce.com">
   <soapenv:Body>
      <createResponse>
         <result>
            <id>003D000000OY9omIAD</id>
            <success>true</success>
         </result>
         <result>
            <id>001D000000HTK3aIAH</id>
            <success>true</success>
         </result>
      </createResponse>
   </soapenv:Body>
 </soapenv:Envelope>

Yields:

{ declaration: { attributes: { version: '1.0', encoding: 'utf-8' } },
  root:
   { name: 'soapenv:Envelope',
     attributes:
      { 'xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
        xmlns: 'urn:enterprise.soap.sforce.com' },
     children:
      [ { name: 'soapenv:Body',
          attributes: {},
          children:
           [ { name: 'createResponse',
               attributes: {},
               children:
                [ { name: 'result',
                    attributes: {},
                    children:
                     [ { name: 'id',
                         attributes: {},
                         children: [],
                         content: '003D000000OY9omIAD' },
                       { name: 'success', attributes: {}, children: [], content: 'true' } ],
                    content: '' },
                  { name: 'result',
                    attributes: {},
                    children:
                     [ { name: 'id',
                         attributes: {},
                         children: [],
                         content: '001D000000HTK3aIAH' },
                       { name: 'success', attributes: {}, children: [], content: 'true' } ],
                    content: '' } ],
               content: '' } ],
          content: '' } ],
     content: '' } }

License

MIT

org.webjars.npm

Segment

Versions

Version
1.2.1