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

p23r-model-compiler

v1.0.2

Published

Compiles P23R model files to XSD schemata with and without types (any type) and generates a converter for data from JSON to XML format

Downloads

8

Readme

README.md

Author: Jan Gottschick [email protected]

This is a P23R model language to XSD schema compiler. P23R model is internally used in the openP23R project to describe schemata but is not part of the official P23R specifications.

https://entwickler.p23r.de

Usage as a command

The compiler is implemented in Javascript and requires node.js, which is available at

http://nodejs.org

After installing node.js you can install the p23r selection compiler, globally, by

npm install p23r-model-compiler

and start the compiler by

modelc

You can enter the p23r model source code via stdin and the target code will appear on stdout, e.g. XSD

cat | modelc xsd
This model is a very simple example

model simple as s release 1.0 {

	creator 'Jan Gottschick'
	organisation 'P23R-Team'
	base http://example.de/NS/
	requires p23r release 1.1

	title 'simple example'

	description 'This model is used by the README file.'

	entity RootTag {
		id : string
	}
}

will output

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.de/NS/Simple1-0" xmlns:s="http://example.de/NS/Simple1-0" elementFormDefault="qualified" version="1.0" >
	<xs:annotation>
		<xs:documentation>
			This model is a very simple example
		</xs:documentation>
	</xs:annotation>

	<xs:complexType name="RootTag"  >
		<xs:attribute name="id" use="required" type="xs:string" >
		</xs:attribute>
	</xs:complexType>
</xs:schema>

The following options are available:

modelc [OPTIONS] [infile [outfile]]

Compile P23R models to various target codes.

Options:

	-s, --suffix [STRING]  add suffix to target namespace of xsd schema (Default is suffix)
	-u, --untyped          generate untyped schema
	-k, --no-color         Omit color from output
	--debug            Show debug information
	-v, --version          Display the current version
	-h, --help             Display help and usage details

Commands:
	xsd

You must include a command as part of the options to specify which type of code should be generated.

Usage inside your code

You can include the p23r model compiler in your project, too. If you build a server side service using node.js just include p23r-model-compiler in your package.json file. You can call the command using a relative path to node_modules/p23r-model-compiler/modelc. Or you use the library the usual way, e.g. in coffeescript

model = require 'p23r-model-compiler'

...
modelTargetCode = model.model2xsd(modelSourceCode)

If you like to use the compiler inside your browser code you can load the p23r model compiler by using bower. Just include p23r-model-compiler in your bower.json file. Then load the files

  • ../p23r-model-compiler/dist/lib/js/modelLib.js
  • ../p23r-model-compiler/dist/lib/js/model2xsd.js

with your web page and call the parser

modelTargetCode = model.parse(modelSourceCode)

Errors can be handled in both cases using try and catch, e.g.

try
	modelTargetCode = model.parse(modelSourceCode)
catch error
	console.log error.name + " in model at " + error.line + "," + error.column + ": " + error.message

Legal issues

This project is part of the openP23R initiative. All related projects are listed at https://gitlab.com/openp23r/openp23r .

The legal conditions see LICENSE file.

The project is maintained by P23R-Team (a) Fraunhofer FOKUS