use of org.whole.lang.xml.util.XmlStoreConsumerVisitor in project whole by wholeplatform.
the class PersistenceTest method testXmlModel2Builder.
@Test
public void testXmlModel2Builder() throws ParserConfigurationException, SAXException, IOException {
IEntity xmlModel = SaxConsumerHandler.parse(this.getClass().getResourceAsStream("persistenceTest.xwl"), "UTF-8", true);
ModelBuilderOperation op = new ModelBuilderOperation();
new XmlStoreConsumerVisitor(op).visit(xmlModel);
PrettyPrinterOperation.prettyPrint(op.wGetResult());
}
use of org.whole.lang.xml.util.XmlStoreConsumerVisitor in project whole by wholeplatform.
the class PersistenceTest method xmlRoundtrip.
private IEntity xmlRoundtrip(IEntity model1) {
ModelBuilderOperation op = new ModelBuilderOperation();
XmlStoreProducerBuilderOperation xmlOp = new XmlStoreProducerBuilderOperation(op);
((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildStartDocument();
new ModelTemplate(model1).apply(xmlOp);
((XmlStoreProducerBuilder) xmlOp.wGetBuilder()).buildEndDocument();
IEntity xmlModel = op.wGetResult();
op = new ModelBuilderOperation();
new XmlStoreConsumerVisitor(op).visit(xmlModel);
IEntity model2 = op.wGetResult();
return model2;
}
use of org.whole.lang.xml.util.XmlStoreConsumerVisitor in project whole by wholeplatform.
the class XmlBuilderPersistenceKit method doReadModel.
protected IEntity doReadModel(IPersistenceProvider pp) throws Exception {
IEntity xmlModel = SaxConsumerHandler.parse(pp.getInputStream(), pp.getEncoding());
ModelBuilderOperation op = new ModelBuilderOperation().withBindings(pp.getBindings());
new XmlStoreConsumerVisitor(op).visit(xmlModel);
return ReflectionFactory.makeRootEntity(op.wGetResult());
}
Aggregations