use of org.whole.lang.xml.builders.IXmlBuilder 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.xml.builders.IXmlBuilder 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.xml.builders.IXmlBuilder in project whole by wholeplatform.
the class XsdModelBuilderTest method testBuilderAPI.
@Category(KnownFailingTests.class)
@Test
public void testBuilderAPI() throws Exception {
Schema xsdFromInputStream = (Schema) XsdPersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream("datatypes.xsd")));
Document document = (Document) XmlSourcePersistenceKit.instance().readModel(new StreamPersistenceProvider(getInputStream("datatypes.xsd")));
IBindingManager bm = BindingManagerFactory.instance.createBindingManager();
bm.wDefValue("mergeCDataSect", true);
XsdDeployStrategies.setDeployStrategy(bm, XsdDeployStrategies.ALL);
ModelBuilderOperation mop = new ModelBuilderOperation();
IBuilderOperation xsdBuilderOperation = new XmlSpecific2XsdBuilderAdapterOperation(mop, bm);
XmlNormalizerBuilderOperation normalizerOp = new XmlNormalizerBuilderOperation(xsdBuilderOperation, bm);
ModelTemplate template = new ModelTemplate(document);
template.apply(new XmlGenericBuilderAdapter((IXmlBuilder) normalizerOp.wGetBuilder(XmlLanguageKit.URI)));
Schema xsdFromXmlModel = (Schema) mop.wGetResult();
Assert.assertTrue(Matcher.match(xsdFromInputStream, xsdFromXmlModel));
}
use of org.whole.lang.xml.builders.IXmlBuilder in project whole by wholeplatform.
the class AttributesMatcherFactory method getDefaultNsDeclPattern.
private static IEntity getDefaultNsDeclPattern() {
if (defaultNsDeclPattern == null) {
ModelBuilderOperation mop = new ModelBuilderOperation();
IXmlBuilder xb = (IXmlBuilder) mop.wGetBuilder(XmlLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) mop.wGetBuilder(CommonsLanguageKit.URI);
xb.Attribute_();
xb.Name("xmlns");
cb.Variable_();
cb.VarType(XmlEntityDescriptorEnum.Value);
cb.VarName("uri");
cb.Quantifier(QuantifierEnum.MANDATORY);
cb._Variable();
xb._Attribute();
defaultNsDeclPattern = mop.wGetResult();
}
return defaultNsDeclPattern;
}
use of org.whole.lang.xml.builders.IXmlBuilder in project whole by wholeplatform.
the class AttributesMatcherFactory method getRefAttrPattern.
private static IEntity getRefAttrPattern() {
if (refAttrPattern == null) {
ModelBuilderOperation mop = new ModelBuilderOperation();
IXmlBuilder xb = (IXmlBuilder) mop.wGetBuilder(XmlLanguageKit.URI);
ICommonsBuilder cb = (ICommonsBuilder) mop.wGetBuilder(CommonsLanguageKit.URI);
xb.Attribute_();
xb.Name("ref");
cb.Variable_();
cb.VarType(XmlEntityDescriptorEnum.Value);
cb.VarName("value");
cb.Quantifier(QuantifierEnum.MANDATORY);
cb._Variable();
xb._Attribute();
refAttrPattern = mop.wGetResult();
}
return refAttrPattern;
}
Aggregations