Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jgexml
Advanced tools
Readme
jgeXml provides an event-driven parser to process XML 1.0 / 1.1. Both pull and push modes are supported. Tools are included for writing XML (documents or fragments) and to convert between XML and JSON.
The code has no dependencies on other modules or native libraries.
Setting up a push-parser is as simple as:
const jgexml = require('jgexml');
const result = jgexml.parse(xml, function(state, token) {
//...
});
sDeclaration
sDocType
sDTD
sElement
sAttribute
sValue
sEndElement
sContent
sComment
sProcessingInstruction
sCData
sError
sEndDocument
No event is generated for ignoreable whitespace, unlike SAX. Empty elements are normalised into sElement/sEndElement pairs.
jgeXml is a non-validating parser. It attempts to report if the XML is well-formed or not.
Both when reading and writing, attributes follow after the element event, and in the order they are given in the source.
When converting to JSON, the attributePrefix (to avoid name clashes with child elements) is configurable per parse.
In JSON, child elements can be represented as properties (the default) or objects (exposing the parser's intermediary state).
The parser by default treats all content as strings when converting to JSON, optionally data can be coerced to primitive numbers or null values.
The xsd2json
utility can convert most simple XML Schemas to JSON schema draft 4. XSD's may of course be converted to JSON simply as if they were XML documents too.
Experimental JSONPath and JSONT utilities are under development.
jgeXml is currently schema agnostic and staunchly atheist when it comes to DTDs. It can parse XML documents with schema information, but it is up to the
consumer to interpret the namespace portions of element names. It can parse internal DTDs, but does nothing with them.
xmlWrite
minimally supports DTDs but you must build them and the DOCTYPE yourself.
The parser is string-based; to process streams, read the data into a string first. It may be memory intensive on large documents.
xml2json
- convert XML to JSON.json2xml
- convert JSON to XML.xsd2json
- convert XSD to JSON Schema.See in the examples
directory: xml2xml.js
for parsing XML to XML, fragment.js
for writing XML fragments, jpath.js
for JSONPath examples, jsont.js
for JSONT examples and pullparser.js
/ pushparser.js
for how to set up and run the parser.
FAQs
The Just-Good-Enough XML Toolkit
The npm package jgexml receives a total of 33,195 weekly downloads. As such, jgexml popularity was classified as popular.
We found that jgexml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.