Search in sources :

Example 1 with XSDIncludeImpl

use of org.eclipse.xsd.impl.XSDIncludeImpl in project tmdm-studio-se by Talend.

the class Util method importSchema.

private static void importSchema(XSDSchema xsdSchema, List<XSDImport> imports, Map<String, Integer> schemaMonitor) {
    EList<XSDSchemaContent> list = xsdSchema.getContents();
    for (XSDSchemaContent schemaCnt : list) {
        if (schemaCnt instanceof XSDImport) {
            XSDImportImpl xsdImpl = (XSDImportImpl) schemaCnt;
            if (xsdImpl.getNamespace() == null || xsdImpl.getNamespace().trim().equals("")) {
                // $NON-NLS-1$
                URI fileURI = URI.createFileURI(xsdImpl.getSchemaLocation());
                // $NON-NLS-1$//$NON-NLS-2$
                xsdImpl.setNamespace(fileURI.toFileString().replaceAll("[\\W]", ""));
            }
            if (xsdImpl.getSchemaLocation() == null) {
                continue;
            }
            ((XSDImportImpl) schemaCnt).importSchema();
            imports.add(((XSDImportImpl) schemaCnt));
        } else if (schemaCnt instanceof XSDInclude) {
            XSDIncludeImpl xsdInclude = (XSDIncludeImpl) schemaCnt;
            ((XSDSchemaImpl) xsdSchema).included(xsdInclude);
        }
    }
}
Also used : XSDImportImpl(org.eclipse.xsd.impl.XSDImportImpl) XSDSchemaContent(org.eclipse.xsd.XSDSchemaContent) XSDImport(org.eclipse.xsd.XSDImport) XSDIncludeImpl(org.eclipse.xsd.impl.XSDIncludeImpl) URI(org.eclipse.emf.common.util.URI) XSDInclude(org.eclipse.xsd.XSDInclude)

Aggregations

URI (org.eclipse.emf.common.util.URI)1 XSDImport (org.eclipse.xsd.XSDImport)1 XSDInclude (org.eclipse.xsd.XSDInclude)1 XSDSchemaContent (org.eclipse.xsd.XSDSchemaContent)1 XSDImportImpl (org.eclipse.xsd.impl.XSDImportImpl)1 XSDIncludeImpl (org.eclipse.xsd.impl.XSDIncludeImpl)1