scalaxb 0.6.0

new feature

bug fixes and other minor enhancements

  • XML bindings are generated as foo_xmlprotocol.scala.
  • Uses Scala 2.9.0-1.
  • Web API uses Unfiltered 0.3.3.
  • Adds default argument for xs:anyAttribute.
  • Adds support for xs:anySimpleType. (#34 reported by @psnively)
  • Fixes xs:any naming. (#35 reported by @psnively)
  • Adds typeclass instance for DataRecord. (#40 reported by @psnively)
  • Fixes DataRecord round trip. (#43)
  • Fixes mapping of xs:choice of xs:anyType. (#44 reported by @psnively)

wsdl 1.1 support

During the .com boom, everyone has written a SOAP service or two, which were typically cataloged using WSDL. If you study a WSDL document, you'll discover that a good portion of the document is actually embedded XML Schema document describing the layout of the messages sent back and forth. The rest are details. Since scalaxb is handling the XML Schema, it was only matter of time to extend this into supporting WSDL.

usage

  1. Download a wsdl document locally.
  2. If you're using sbt-scalaxb place it under src/main/wsdl.

Here's the sample setup:

scalaxb 0.5.4

  • Added sbt-scalaxb plugin by @max4f.
  • Added --package-dir, which generates package directory structure.
  • scalaxb is now available via conscript: cs eed3si9n/scalaxb.
  • Fixes generated code for cross-package choices (GH-33).

sbt-scalaxb is in the house

A big thanks to Max (@max4f) for writing a scalaxb plugin for sbt, and letting me pull it into the project.
If you're not using simple build tool, why?

Here are the steps to compile-xsd task from sbt.

step 1. Plugins.scala

Add the following to your project/plugins/Plugins.scala.

import sbt._
 
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val scalaxb = "org.scalaxb" % "sbt-scalaxb" % "0.6.0"
 
  val scalaToolsNexusSnapshots = "Scala Tools Nexus Snapshots" at "http://nexus.scala-tools.org/content/repositories/snapshots/"
  val scalaToolsNexusReleases  = "Scala Tools Nexus Releases" at "http://nexus.scala-tools.org/content/repositories/releases/"
}

scalaxb 0.5.3

breaking changes (no import)

  • Moved helper functions from Scalaxb object into scalaxb package object.
  • Moved default typeclass instances from DefaultXMLProtocol trait to the package object of the generated class. (inspired by @jsuereth at #nescala)

Before:

import scalaxb._
import Scalaxb._
import ipo._
import DefaultXMLProtocol._
val shipTo = fromXML[Address](subject)

After:

val shipTo = scalaxb.fromXML[ipo.Address](subject)

bug fixes and minor enhancements

  • Maps xs:integer, etc. to BigInt.
  • Fixed substitution group parsing (GH-25 reported by @dbolene)
  • Implements attributeFormDefault, elementFormDefault, and form support. (GH-26 reported by @dbolene)
  • Fixed parsing long sequence. (GH-29 reported by E-Fir)
  • Implements UTF-8 and UTF-16 BOM handling. (GH-31 reported by @fredferrao)
  • Prints version number. (GH-24 requested by @dbolene)
  • Prints better parser error message. (GH-27 reported by @dbolene)

scalaxb 0.5.2

  • Fixes <xs:sequence> handling. (GH-19)
  • Fixes <xs:attributeGroup> handling. (GH-21)
  • Improves error message when a referenced schema or referenced component is missing.
  • Searches for missing schema in the current directory. (GH-23)

multiple schema files

This page explains a single execution of scalaxb that involves multiple schema files. For multiple runs of scalaxb, see multiple configs.

<xs:include> and <xs:import>

In XML Schema, schema components for a single target namespace can be assembled from multiple schema definition documents using <xs:include>. For example XML Schema translation of MathML 3's mathml3-content.xsd contains the following:

<xs:include schemaLocation="mathml3-strict-content.xsd"/> 

navigating XML Schema

This is a memo to navigate around the case classes for XML Schema. Besides the derivation by extension that programming languages have as inheritance, XML Schema also allows derivation by restriction. Since Scala I don't think expresses this easily, some types are wider than how they are specified in the schema.

XElement

  • known subclasses: XTopLevelElement, XLocalElementable, XNarrowMaxMin, XLocalElement
  • value member: xelementoption : Option[DataRecord[XElementOption]]

typeclass-based XML data binding

Ultimately, the users of scalaxb are interested the real problems that the entity objects express, not how they persist into XML. That's why I knew I eventually had to vacate the singleton/companion object of the case class to implement the data binding. Until recently it has been generating the data binding implementation as follows:

object Address extends rt.ElemNameParser[Address] {
  val targetNamespace = "http://www.example.com/IPO"
 
  def parser(node: scala.xml.Node): Parser[Address] =
    ...
 

scalaxb 0.5.1

  • Command line program uses Scala 2.8.1.
  • Fixes accessors to compositors by using type name as the param name. (GH-18)
  • Fixes generated type of nillable varargs. (also GH-18)
Syndicate content