npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wikipathways/cxsd

v0.2.10

Published

Streaming XSD parser and XML parser generator with TypeScript output

Downloads

1,178

Readme

cxsd

build status dependency status npm version

Atom screenshot

cxsd is a streaming XSD parser and XML parser generator for Node.js and (optionally but highly recommended) TypeScript. It automatically downloads all referenced .xsd files and outputs two files for each defined namespace:

  • .js JavaScript code for Node.js containing a compact state machine table for the cxml parser.
  • .d.ts TypeScript definition with JSDoc comments to help editors with tab completion, type verification and tooltips.

Since namespaces map to source files, compiled namespaces can import others like normal JavaScript files.

cxml itself is highly advanced and unlike other JavaScript XML parsers. It fully supports namespaces, derived types and (soon) substitution groups. Output structure is defined mainly by schema, not the XML input. You can correctly parse files with completely unexpected structures (conditions apply) and element names, if they refer to a schema mapping the contents to supported equivalents.

Usage

echo '{ "scripts": { "cxsd": "cxsd" } }' > package.json
npm install cxsd
npm run cxsd http://schemas.opengis.net/wfs/1.1.0/wfs.xsd

The first line just sets up NPM to allow calling cxsd without installing it globally. It also works on Windows if you omit the single quotes (').

This downloads 96 .xsd files (total about 720 kilobytes) and produces 9 .js files for the XML parser (total about 90 kilobytes) and 9 .d.ts files (total about 480 kilobytes) for TypeScript editors to statically verify the parser output is correctly used and generally help the programmer.

You can import the resulting .d.ts and .js files from TypeScript:

import * as wfs from './xmlns/www.opengis.net/wfs';
import * as ows from './xmlns/www.opengis.net/ows';

var metadata = wfs.document.WFS_Capabilities.OperationsMetadata;

See how the Atom editor with atom-typescript understands the code in the screenshot at the top.

Features

  • Automatically download and cache to disk all imported .xsd files
  • Convert XSD contents to ES6 equivalents (generated .js files call cxml to parse themselves into JavaScript structures)
    • Types to classes
      • Deriving from other types to inheriting other classes
    • Imports from remote URLs to imports from local relative paths
    • Strings, numbers and dates to matching primitive types
    • Lists to arrays
  • To TypeScript equivalents (defined in .d.ts for working with source code)
    • Annotations to JSDoc comments
    • Enumerations to unions of string literals

Related projects

License

The MIT License

Copyright (c) 2015-2016 BusFaster Ltd