Hyperjaxb3 0.5.6 is released
This release features two major highlights:
It also fixes a great number of issues, please see release notes here and here.
I am glad to announce the first release of, Jsonix.
Jsonix (JSON interfaces for XML) is a JavaScript library which allows you to convert between XML and JSON structures. Jsonix is essentially a JavaScript analog of JAXB.
With Jsonix you can parse XML into JSON (this process is called unmarshalling) or serialize JSON in XML form (this is called marshalling).
These conversions are based on simple XML/JSON mappings which can be written manually or generated from an XML Schema.
Project website:
Downloads:
Download features:
User guide:
Mailing lists:
var context = Jsonix.Context.newInstance([ PO ]);
// Marshal JSON as XML (DOM node)
var unmarshaller = context.createUnmarshaller();
var node = marshaller.marshal({
name: {localPart: "purchaseOrder"},
value: {
shipTo: {
name: "Alice Smith",
street: "123 Maple Street",
city: "Mill Valley",
state: "CA",
zip: 90952
}
}
});
<purchaseOrder orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<!-- ... -->
</purchaseOrder>
// Unmarshal JSON from XML (retrieved from an URL)
var unmarshaller = context.createUnmarshaller();
unmarshaller.unmarshal({
url : "po.xml",
success : function(po) {
assertEquals("purchaseOrder", po.name.localPart);
assertEquals("Alice Smith", po.value.shipTo.name);
}
});
The project is in development, I'll be working on it next weeks.
// Instantiate the code model
JSCodeModel codeModel = new CodeModelImpl();
// Create the program
JSProgram program = codeModel.program();
// Add a function declaration
JSFunctionDeclaration factorial = program
.functionDeclaration("factorial");
// Add a function parameter
JSVariable x = factorial.parameter("x");
// Create an integer literal
JSDecimalIntegerLiteral one = codeModel.integer(1);
// Add a return statement to the function body
factorial.getBody()._return(
x.le(one).cond(
one,
x.mul(factorial.getFunctionExpression().i()
.args(x.minus(one)))));
// Write the program code to the System.out
new CodeWriter(System.out).program(program);
function factorial(x) {
return x <= 1 ? 1 : x * factorial(x - 1); }
System.out
. This process almost guarantees that the resulting code is syntactically and grammatically correct - and well-formatted as well. And I hope the API is very convenient - especially if you compare it to the "good old" string concatenation.
JSProgram program = codeModel.program();
JSNumericLiteral one = codeModel.lit(1);
JSFunctionDeclaration factorial =
program.declare("factorial");
JSVariable x = factorial.parameter("x");
factorial.body()._return(
x.le(one).cond(one,
x.mul(codeModel.call(factorial).args(x.minus(one)))));
function factorial(x)
{ return x <= 1 ? 1 : x * factorial(x - 1); }
JSIfStatement _if = factorial.body()._if(x.le(one));
_if._then()._return(one);
_if._else()._return(
x.mul(codeModel.call(factorial).args(x.minus(one))));
Labels: jaxb javascript ecmascript codemodel xml programmatic
property
element to an existing JNLP file. There were also similar requirements from a project partner, so all in all it goes into a direction of programmatic manipulation of JNLP files.Labels: dtd, jaxb, jnlp, juneloop, maven-jaxb2-plugin, open-source, programmatic
Labels: open-source
many-to-many
(instead of default one-to-many
), choose between join-column
or join-table
association strategies per default and many other things.