Search in sources :

Example 1 with NamespaceDecl

use of org.whole.lang.xsd.model.NamespaceDecl in project whole by wholeplatform.

the class AttributesPreprocessor method processNoNamespaceSchemaLocation.

protected void processNoNamespaceSchemaLocation(String schemaLocationUrl) {
    String targetNamespace = calculateInternalNamespace(true);
    Schema schema = SchemaUtils.load(targetNamespace, schemaLocationUrl, getFolderLocation(), getLSResourceResolver());
    // add the generated default namespace to the schema
    final XsdEntityFactory xef = XsdEntityFactory.instance;
    NamespaceDecl namespaceDecl = xef.createNamespaceDecl();
    namespaceDecl.setUri(xef.createAnyURI(targetNamespace));
    schema.getNamespaces().add(namespaceDecl);
    schema.setTargetNamespace(xef.createAnyURI(targetNamespace));
    if (XsdDeployStrategies.shouldDeploy(bindings, targetNamespace))
        SchemaUtils.deploy(schema, BindingManagerFactory.instance.createArguments());
    redefineDefaultNamespace(namespaces, targetNamespace);
}
Also used : Schema(org.whole.lang.xsd.model.Schema) NamespaceDecl(org.whole.lang.xsd.model.NamespaceDecl) XsdEntityFactory(org.whole.lang.xsd.factories.XsdEntityFactory)

Example 2 with NamespaceDecl

use of org.whole.lang.xsd.model.NamespaceDecl in project whole by wholeplatform.

the class NamespaceDeclPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    NamespaceDecl entity = getModelEntity();
    List<IEntity> children = new ArrayList<IEntity>(2);
    children.add(entity.getPrefix());
    children.add(entity.getUri());
    return children;
}
Also used : IEntity(org.whole.lang.model.IEntity) NamespaceDecl(org.whole.lang.xsd.model.NamespaceDecl) ArrayList(java.util.ArrayList)

Example 3 with NamespaceDecl

use of org.whole.lang.xsd.model.NamespaceDecl in project whole by wholeplatform.

the class XsdPrettyPrinterVisitor method visit.

@Override
public void visit(IEntity entity) {
    if (Matcher.match(XsdEntityDescriptorEnum.NamespaceDecl, entity)) {
        NamespaceDecl nsDecl = (NamespaceDecl) entity;
        IPrettyPrintWriter prettyPrintWriter = getOperation().getPrettyPrintWriter();
        prettyPrintWriter.printRaw(nsDecl.getPrefix().getValue());
        prettyPrintWriter.printRaw("=");
        prettyPrintWriter.printRaw(nsDecl.getUri().getValue());
    } else
        super.visit(entity);
}
Also used : NamespaceDecl(org.whole.lang.xsd.model.NamespaceDecl) IPrettyPrintWriter(org.whole.lang.operations.IPrettyPrintWriter)

Aggregations

NamespaceDecl (org.whole.lang.xsd.model.NamespaceDecl)3 ArrayList (java.util.ArrayList)1 IEntity (org.whole.lang.model.IEntity)1 IPrettyPrintWriter (org.whole.lang.operations.IPrettyPrintWriter)1 XsdEntityFactory (org.whole.lang.xsd.factories.XsdEntityFactory)1 Schema (org.whole.lang.xsd.model.Schema)1