use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class AttributesMatcherFactory method getQualifiedRefAttrPattern.
private static IEntity getQualifiedRefAttrPattern() {
if (qualifiedRefAttrPattern == null) {
ModelBuilderOperation mop = new ModelBuilderOperation();
IXmlBuilder xb = (IXmlBuilder) mop.wGetBuilder(XmlLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) mop.wGetBuilder(CommonsLanguageKit.URI);
xb.Attribute_();
xb.QualifiedName_();
cb.Variable_();
cb.VarType("http://lang.whole.org/Xml#NameSpace");
cb.VarName("xmlns");
cb.Quantifier("!");
cb._Variable();
xb.Name("ref");
xb._QualifiedName();
cb.Variable_();
cb.VarType("http://lang.whole.org/Xml#Value");
cb.VarName("value");
cb.Quantifier("!");
cb._Variable();
xb._Attribute();
qualifiedRefAttrPattern = mop.wGetResult();
}
return qualifiedRefAttrPattern;
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class AttributesMatcherFactory method getNsDeclPattern.
private static IEntity getNsDeclPattern() {
if (nsDeclPattern == null) {
ModelBuilderOperation mop = new ModelBuilderOperation();
IXmlBuilder xb = (IXmlBuilder) mop.wGetBuilder(XmlLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) mop.wGetBuilder(CommonsLanguageKit.URI);
xb.Attribute_();
xb.QualifiedName_();
xb.NameSpace("xmlns");
cb.Variable_();
cb.VarType(XmlEntityDescriptorEnum.Name);
cb.VarName("xmlns");
cb.Quantifier(QuantifierEnum.MANDATORY);
cb._Variable();
xb._QualifiedName();
cb.Variable_();
cb.VarType(XmlEntityDescriptorEnum.Value);
cb.VarName("uri");
cb.Quantifier(QuantifierEnum.MANDATORY);
cb._Variable();
xb._Attribute();
nsDeclPattern = mop.wGetResult();
}
return nsDeclPattern;
}
use of org.whole.lang.builders.ModelBuilderOperation in project whole by wholeplatform.
the class PersistenceTest method testSaxHandlerBuilder.
@Test
public void testSaxHandlerBuilder() throws Exception {
Document xmlModel = (Document) XmlSourcePersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/xsd/util/javaee_web_services_client_1_2.xsd"));
ModelBuilderOperation op = new ModelBuilderOperation();
SaxConsumerHandler saxHandler = new SaxConsumerHandler(op, !EntityUtils.isResolver(xmlModel.getProlog().getXmlDecl()));
SaxHandlerBuilderOperation sbop = new SaxHandlerBuilderOperation(saxHandler, saxHandler);
new ModelTemplate(xmlModel).apply(sbop);
assertTrue(Matcher.match(op.wGetResult(), xmlModel));
}
use of org.whole.lang.builders.ModelBuilderOperation 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.builders.ModelBuilderOperation in project whole by wholeplatform.
the class PersistenceTest method testSingleBuilder2Xml.
@Test
public void testSingleBuilder2Xml() {
ModelBuilderOperation op = new ModelBuilderOperation();
new ModelsModel().apply(new XmlStoreProducerBuilderOperation(op));
IEntity xmlModel = op.wGetResult();
PrettyPrinterOperation.prettyPrint(xmlModel);
}
Aggregations