JXC is a Java project for converting XML from one form to another.

It can be used as a Java library or GUI tool to:

  • Filter XML documents using XPath expressions
  • Map XML documents from one schema to another
  • Export mappings created as XSL stylesheets
For further information see:

Tools
Java API

XMLMapper mapper = new XMLMapper();
mapper.addMapping(new XMLMapping("orders", “customer_orders”);
mapper.addMapping(new XMLMapping("orders/order", “customer_orders/customer_order”, “customerName = 'Henry'”);
mapper.addMapping(new XMLMapping("orders/order/orderDate", “customer_orders/customer_order/@orderDate”);
mapper.addMapping(new XMLMapping("orders/order/orderRef", “customer_orders/customer_order/@orderRef”);
mapper.addMapping(new XMLMapping("orders/order/deliveryAddress/postCode", “customer_orders/customer_order/@postCode”);
mapper.addMapping(new XMLMapping("orders/order/status", “customer_orders/customer_order/@status”);
mapper.addMapping(new XMLDefault(“customer_orders/customer_order/@statusCode”, “status = ‘Dispatched’”, “DSP”);
mapper.addMapping(new XMLDefault(“customer_orders/customer_order/@statusCode”, “status = ‘Pending’”, “PND”);
mapper.addMapping(new XMLMapping("orders/order/item/price", “customer_orders/customer_order/@totalValue”, null, XSLTFunction.SUM);
String mappedXML = XMLUtil.toXMLString(mapper.apply(new File("Orders.xml")));
System.out.println(“Mapped XML=”+mappedXML);
Copyright 2010, Andrew Leigh, All rights reserved