README

GoDoc Build Status

Installation

Requires go 1.9 or greater for golang.org/x/html dependency.

go get aqwari.net/xml/...

This repository contains a collection of Go packages for working with XML, with the ultimate goal of enabling code generation based on XML documents.

  • The xmltree package converts xml documents to a tree data structure, and provides convenient methods for manipulating and searching through that tree.
  • The xsd package implements a parser for XML Schema. It takes some liberties from the specification, and would need some work for use as a validator, but it handles type inheritance and XML namespaces in a relatively sane way.
  • The xsdgen package provides a customizable code generator that generates Go type declarations and marshal/unmarshal methods for an XML Schema.
  • The wsdl package parses Web Service Definition Language (WSDL) files, which describe a (usually) SOAP web service.
  • The wsdlgen package generates Go source code from WSDL files.
  • The xsdgen and wsdlgen commands generate Go code with default settings and are suitable for use with go generate.

The directory wsdlgen/examples contains packages that were (mostly) automatically generated using the wsdlgen package. You can run

go generate

within the subdirectories to re-generate the code if you make changes to the wsdlgen package. This code is still very rough around the edges, but I have succesfully used it to generate type declarations for some pretty complex XML schema from an Apache Axis application. There are github issues opened for missing functionality.

Expand ▾ Collapse ▴

Directories

Path Synopsis
cmd
xsdgen
xsdgen is a tool to automatically generate Go type declarations and associated methods based on one or more XML Schema.
xsdgen is a tool to automatically generate Go type declarations and associated methods based on one or more XML Schema.
Package gentest generates marshal/unmarshal tests for the xsdgen package.
Package gentest generates marshal/unmarshal tests for the xsdgen package.
_testgen
testgen is a wrapper around xsdgen that generates unit for generated code.
testgen is a wrapper around xsdgen that generates unit for generated code.
Package wsdl parses Web Service Definition Language documents.
Package wsdl parses Web Service Definition Language documents.
Package wsdlgen generates Go source code from wsdl documents.
Package wsdlgen generates Go source code from wsdl documents.
examples/chemspell
Package chemspell accesses the NLM ChemSpell web service.
Package chemspell accesses the NLM ChemSpell web service.
examples/forecast
Package forecast access the National Digital Forecast Database.
Package forecast access the National Digital Forecast Database.
Package xmltree converts XML documents into a tree of Go values.
Package xmltree converts XML documents into a tree of Go values.
Package xsd parses type declarations in XML Schema documents.
Package xsd parses type declarations in XML Schema documents.
Package xsdgen generates Go source code from xml schema documents.
Package xsdgen generates Go source code from xml schema documents.
internal
commandline
Package commandline contains helper types for collecting command-line arguments.
Package commandline contains helper types for collecting command-line arguments.
dependency
Package dependency builds and flattens dependency graphs.
Package dependency builds and flattens dependency graphs.
gen
Package gen provides functions for generating go source code The gen package provides wrapper functions around the go/ast and go/token packages to reduce boilerplate.
Package gen provides functions for generating go source code The gen package provides wrapper functions around the go/ast and go/token packages to reduce boilerplate.