MinXConf Tutorial
How to Parse MinXConf
The class com.steelypip.powerups.minxconf.MinXConfParser is used to parse JSON as MinXML from a java.io.Reader source. For example, we can prepare a file data.minxconf as follows:
// Here's some random configuration values.
foo : 1
bar : 2
To parse this, we simply use the constructor of MinXConfParser to create a parser, which will read from the data.minxconf file once it has been changed into a Reader via java.io.FileReader.
import com.steelypip.powerups.minxconf.MinXConf; import com.steelypip.powerups.minx.MinXML; import java.io.FileReader; import java.io.File; ... MinXML m = new MinXConfParser( new FileReader( new File( "data.minxconf" ) ) ).read(); m.prettyPrint();
The result looks like this:
<object> <constant field="foo" type="integer" value="1"/> <constant field="bar" type="integer" value="2"/> </object>
page revision: 4, last edited: 07 Nov 2014 13:21