Coder Social home page Coder Social logo

xml-schema's Introduction

xml-schema

Build Status Latest Version Coverage Status

Generate rust code (structures and enum) from XSD

Requirements

This project depends to other required libraries to start with, add them to your Cargo.toml.

Usage

In the entrypoint of your rust project, add these folowing lines:

#[macro_use]
extern crate yaserde_derive;

use std::io::prelude::*;
use xml_schema_derive::XmlSchema;
use yaserde::{YaDeserialize, YaSerialize};

Then implement the XSD using:

#[derive(Debug, XmlSchema)]
#[xml_schema(source = "path_to_schema.xsd", target_prefix = "my_prefix")]
struct MySchema;

Remark: the MySchema don't need to be public. It serve just as support of information.

Attributes

source: Source of the XSD - XML Schema. It can be local file (related to the root of the project) or an HTTP resource.
target_prefix: The schema not define any prefix. It the targetNamespace is declared in the schema, this attribute is required.
store_generated_code: Optional attribute for debug purpose. It store the generated Rust code into the file - the attribute value is the output filename.
log_level: To configure the logger level at the the compile time - usefull if the XSD generate some bugs. Values can be error, warn, info, debug, trace.
module_namespace_mapping: map a namespace to a Rust module. It can be present many times to map multiple namespaces to different Rust modules.

xml-schema's People

Contributors

marcantoine-arnaud avatar marcelbuesing avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.