| | produce structured documents. |
| | |
| | +# Usage |
| | + |
| | +This section shows how to use the Java API to query a database and generate |
| | +an XML document based on **rxm**. Review the |
| | +[JDBC documentation](http://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html) to understand how database connections are established. |
| | + |
| | +## Basic |
| | + |
| | +Use the **rxm** Java API to generate an XML document as follows: |
| | + |
| | +``` |
| | +import com.whitemagicsoftware.rxm.RelationMap; |
| | + |
| | +public class QueryTest { |
| | + public static void main( String args[] ) throws Exception { |
| | + RelationMap rxm = new RelationMap( |
| | + "root > people," + |
| | + "person > person," + |
| | + ".*," |
| | + ); |
| | + |
| | + System.out.println( rxm.toXML( getConnection() ) ); |
| | + } |
| | +} |
| | +``` |
| | + |
| | +## Modules |
| | + |
| | +The **rxm** API allows the definition of modules, such as: |
| | + |
| | +``` |
| | +import com.whitemagicsoftware.rxm.RelationMap; |
| | + |
| | +public class QueryTest { |
| | + public static void main( String args[] ) throws Exception { |
| | + RelationMap rxm = new RelationMap( |
| | + "module person," + |
| | + "person > person," + |
| | + ".*," |
| | + ); |
| | + |
| | + rxm.addExpression( "root > people, import person," ); |
| | + |
| | + System.out.println( rxm.toJSON( getConnection() ) ); |
| | + } |
| | +} |
| | +``` |
| | + |
| | + |
| | # Syntax |
| | |
 |
| | address > address, |
| | .*, |
| | -``` |
| | - |
| | - |
| | -# Usage |
| | - |
| | -This implementation provides a Java API for building SQL statements |
| | -that produce XML documents based on **rxm**. Review the |
| | -[JDBC documentation](http://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html) to obtain a database connection. |
| | - |
| | -## Basic |
| | - |
| | -Use the **rxm** Java API to generate an XML document as follows: |
| | - |
| | -``` |
| | -import com.whitemagicsoftware.rxm.RelationMap; |
| | - |
| | -public class QueryTest { |
| | - public static void main( String args[] ) throws Exception { |
| | - RelationMap rxm = new RelationMap( |
| | - "root > people," + |
| | - "person > person," + |
| | - ".*," |
| | - ); |
| | - |
| | - System.out.println( rxm.toXML( getConnection() ) ); |
| | - } |
| | -} |
| | -``` |
| | - |
| | -## Modules |
| | - |
| | -The **rxm** API allows the definition of modules, such as: |
| | - |
| | ``` |
| | -import com.whitemagicsoftware.rxm.RelationMap; |
| | - |
| | -public class QueryTest { |
| | - public static void main( String args[] ) throws Exception { |
| | - RelationMap rxm = new RelationMap( |
| | - "module people," + |
| | - "root > people," + |
| | - "person > person," + |
| | - ".*," |
| | - ); |
| | - |
| | - rxm.setQuery( "import people," ); |
| | |
| | - System.out.println( rxm.toXML( getConnection() ) ); |
| | - } |
| | -} |
| | -``` |
| | |
| | # Requirements |