Search in sources :

Example 1 with XSTerm

use of org.apache.xerces.xs.XSTerm in project winery by eclipse.

the class BackendUtils method deriveWPD.

/**
 * Derives Winery's Properties Definition from an existing properties definition
 *
 * @param ci     the entity type to try to modify the WPDs
 * @param errors the list to add errors to
 */
public static void deriveWPD(TEntityType ci, List<String> errors) {
    BackendUtils.LOGGER.trace("deriveWPD");
    PropertiesDefinition propertiesDefinition = ci.getPropertiesDefinition();
    QName element = propertiesDefinition.getElement();
    if (element == null) {
        BackendUtils.LOGGER.debug("only works for an element definition, not for types");
    } else {
        BackendUtils.LOGGER.debug("Looking for the definition of {" + element.getNamespaceURI() + "}" + element.getLocalPart());
        // fetch the XSD defining the element
        final XsdImportManager xsdImportManager = RepositoryFactory.getRepository().getXsdImportManager();
        Map<String, RepositoryFileReference> mapFromLocalNameToXSD = xsdImportManager.getMapFromLocalNameToXSD(new Namespace(element.getNamespaceURI(), false), false);
        RepositoryFileReference ref = mapFromLocalNameToXSD.get(element.getLocalPart());
        if (ref == null) {
            String msg = "XSD not found for " + element.getNamespaceURI() + " / " + element.getLocalPart();
            BackendUtils.LOGGER.debug(msg);
            errors.add(msg);
            return;
        }
        final Optional<XSModel> xsModelOptional = BackendUtils.getXSModel(ref);
        if (!xsModelOptional.isPresent()) {
            LOGGER.error("no XSModel found");
        }
        XSModel xsModel = xsModelOptional.get();
        XSElementDeclaration elementDeclaration = xsModel.getElementDeclaration(element.getLocalPart(), element.getNamespaceURI());
        if (elementDeclaration == null) {
            String msg = "XSD model claimed to contain declaration for {" + element.getNamespaceURI() + "}" + element.getLocalPart() + ", but it did not.";
            BackendUtils.LOGGER.debug(msg);
            errors.add(msg);
            return;
        }
        // go through the XSD definition and
        XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
        if (typeDefinition instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition cTypeDefinition = (XSComplexTypeDefinition) typeDefinition;
            XSParticle particle = cTypeDefinition.getParticle();
            if (particle == null) {
                BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Complex type does not contain particles");
            } else {
                XSTerm term = particle.getTerm();
                if (term instanceof XSModelGroup) {
                    XSModelGroup modelGroup = (XSModelGroup) term;
                    if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) {
                        XSObjectList particles = modelGroup.getParticles();
                        int len = particles.getLength();
                        boolean everyThingIsASimpleType = true;
                        PropertyDefinitionKVList list = new PropertyDefinitionKVList();
                        if (len != 0) {
                            for (int i = 0; i < len; i++) {
                                XSParticle innerParticle = (XSParticle) particles.item(i);
                                XSTerm innerTerm = innerParticle.getTerm();
                                if (innerTerm instanceof XSElementDeclaration) {
                                    XSElementDeclaration innerElementDeclaration = (XSElementDeclaration) innerTerm;
                                    String name = innerElementDeclaration.getName();
                                    XSTypeDefinition innerTypeDefinition = innerElementDeclaration.getTypeDefinition();
                                    if (innerTypeDefinition instanceof XSSimpleType) {
                                        XSSimpleType xsSimpleType = (XSSimpleType) innerTypeDefinition;
                                        String typeNS = xsSimpleType.getNamespace();
                                        String typeName = xsSimpleType.getName();
                                        if (typeNS.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
                                            PropertyDefinitionKV def = new PropertyDefinitionKV();
                                            def.setKey(name);
                                            // convention at WPD: use "xsd" as prefix for XML Schema Definition
                                            def.setType("xsd:" + typeName);
                                            list.add(def);
                                        } else {
                                            everyThingIsASimpleType = false;
                                            break;
                                        }
                                    } else {
                                        everyThingIsASimpleType = false;
                                        break;
                                    }
                                } else {
                                    everyThingIsASimpleType = false;
                                    break;
                                }
                            }
                        }
                        if (everyThingIsASimpleType) {
                            // everything went allright, we can add a WPD
                            WinerysPropertiesDefinition wpd = new WinerysPropertiesDefinition();
                            wpd.setIsDerivedFromXSD(Boolean.TRUE);
                            wpd.setElementName(element.getLocalPart());
                            wpd.setNamespace(element.getNamespaceURI());
                            wpd.setPropertyDefinitionKVList(list);
                            ModelUtilities.replaceWinerysPropertiesDefinition(ci, wpd);
                            BackendUtils.LOGGER.debug("Successfully generated WPD");
                        } else {
                            BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Not all types in the sequence are simple types");
                        }
                    } else {
                        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Model group is not a sequence");
                    }
                } else {
                    BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Not a model group");
                }
            }
        } else {
            BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: No Complex Type Definition");
        }
    }
}
Also used : XSTypeDefinition(org.apache.xerces.xs.XSTypeDefinition) XSObjectList(org.apache.xerces.xs.XSObjectList) PropertyDefinitionKV(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKV) XSParticle(org.apache.xerces.xs.XSParticle) XSTerm(org.apache.xerces.xs.XSTerm) QName(javax.xml.namespace.QName) WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition) Namespace(org.eclipse.winery.common.ids.Namespace) HasTargetNamespace(org.eclipse.winery.model.tosca.HasTargetNamespace) XSComplexTypeDefinition(org.apache.xerces.xs.XSComplexTypeDefinition) XSSimpleType(org.apache.xerces.impl.dv.XSSimpleType) RepositoryFileReference(org.eclipse.winery.common.RepositoryFileReference) WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition) PropertiesDefinition(org.eclipse.winery.model.tosca.TEntityType.PropertiesDefinition) XSElementDeclaration(org.apache.xerces.xs.XSElementDeclaration) XSModel(org.apache.xerces.xs.XSModel) PropertyDefinitionKVList(org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKVList) XsdImportManager(org.eclipse.winery.repository.backend.xsd.XsdImportManager) XSModelGroup(org.apache.xerces.xs.XSModelGroup)

Example 2 with XSTerm

use of org.apache.xerces.xs.XSTerm in project iaf by ibissource.

the class XmlTypeToJsonSchemaConverter method handleParticle.

public void handleParticle(JsonObjectBuilder builder, XSParticle particle, XSObjectList attributeUses, boolean forProperties) {
    if (particle == null) {
        throw new NullPointerException("particle is null");
    }
    XSTerm term = particle.getTerm();
    if (term == null) {
        throw new NullPointerException("particle.term is null");
    }
    handleTerm(builder, term, attributeUses, particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1, forProperties);
}
Also used : XSTerm(org.apache.xerces.xs.XSTerm)

Example 3 with XSTerm

use of org.apache.xerces.xs.XSTerm in project iaf by ibissource.

the class XmlTypeToJsonSchemaConverter method buildObject.

private void buildObject(JsonObjectBuilder builder, XSObjectList particles, XSObjectList attributeUses, String textAttribute, XSTypeDefinition baseType) {
    builder.add("type", "object");
    builder.add("additionalProperties", false);
    JsonObjectBuilder propertiesBuilder = Json.createObjectBuilder();
    List<String> requiredProperties = new ArrayList<String>();
    if (attributeUses != null) {
        for (int i = 0; i < attributeUses.getLength(); i++) {
            XSAttributeUse attributeUse = (XSAttributeUse) attributeUses.get(i);
            XSAttributeDeclaration attributeDecl = attributeUse.getAttrDeclaration();
            propertiesBuilder.add(attributePrefix + attributeDecl.getName(), getDefinition(attributeDecl.getTypeDefinition(), true));
        }
    }
    if (textAttribute != null && ((attributeUses != null && attributeUses.getLength() > 0) || (particles != null && particles.getLength() > 0))) {
        JsonObject elementType = baseType != null ? getDefinition(baseType, true) : Json.createObjectBuilder().add("type", "string").build();
        propertiesBuilder.add(textAttribute, elementType);
    }
    if (particles != null) {
        for (int i = 0; i < particles.getLength(); i++) {
            XSParticle childParticle = (XSParticle) particles.item(i);
            if (log.isTraceEnabled())
                log.trace("childParticle [" + i + "][" + ToStringBuilder.reflectionToString(childParticle, ToStringStyle.MULTI_LINE_STYLE) + "]");
            XSTerm childTerm = childParticle.getTerm();
            if (childTerm instanceof XSElementDeclaration) {
                XSElementDeclaration elementDeclaration = (XSElementDeclaration) childTerm;
                String elementName = elementDeclaration.getName();
                if (elementName != null && childParticle.getMinOccurs() != 0) {
                    requiredProperties.add(elementName);
                }
            }
            handleParticle(propertiesBuilder, childParticle, null, true);
        }
    }
    builder.add("properties", propertiesBuilder.build());
    if (requiredProperties.size() > 0) {
        JsonArrayBuilder requiredPropertiesBuilder = Json.createArrayBuilder();
        for (String requiredProperty : requiredProperties) {
            requiredPropertiesBuilder.add(requiredProperty);
        }
        builder.add("required", requiredPropertiesBuilder.build());
    }
}
Also used : XSParticle(org.apache.xerces.xs.XSParticle) XSTerm(org.apache.xerces.xs.XSTerm) ArrayList(java.util.ArrayList) XSElementDeclaration(org.apache.xerces.xs.XSElementDeclaration) XSAttributeDeclaration(org.apache.xerces.xs.XSAttributeDeclaration) JsonObject(javax.json.JsonObject) XSAttributeUse(org.apache.xerces.xs.XSAttributeUse) JsonArrayBuilder(javax.json.JsonArrayBuilder) JsonObjectBuilder(javax.json.JsonObjectBuilder)

Example 4 with XSTerm

use of org.apache.xerces.xs.XSTerm in project winery by eclipse.

the class BackendUtils method deriveWPD.

/**
 * Derives Winery's Properties Definition from an existing properties definition
 *
 * @param ci     the entity type to try to modify the WPDs
 * @param errors the list to add errors to
 */
// FIXME this is specifically for xml backends and therefore broken under the new canonical model
public static void deriveWPD(TEntityType ci, List<String> errors, IRepository repository) {
    BackendUtils.LOGGER.trace("deriveWPD");
    TEntityType.PropertiesDefinition propertiesDefinition = ci.getProperties();
    if (propertiesDefinition == null) {
        // if there's no properties definition, there's nothing to derive because we're in YAML mode
        return;
    }
    if (!(propertiesDefinition instanceof TEntityType.XmlElementDefinition)) {
        BackendUtils.LOGGER.debug("only works for an element definition, not for types");
        return;
    }
    final QName element = ((TEntityType.XmlElementDefinition) propertiesDefinition).getElement();
    BackendUtils.LOGGER.debug("Looking for the definition of {" + element.getNamespaceURI() + "}" + element.getLocalPart());
    // fetch the XSD defining the element
    final XsdImportManager xsdImportManager = repository.getXsdImportManager();
    Map<String, RepositoryFileReference> mapFromLocalNameToXSD = xsdImportManager.getMapFromLocalNameToXSD(new Namespace(element.getNamespaceURI(), false), false);
    RepositoryFileReference ref = mapFromLocalNameToXSD.get(element.getLocalPart());
    if (ref == null) {
        String msg = "XSD not found for " + element.getNamespaceURI() + " / " + element.getLocalPart();
        BackendUtils.LOGGER.debug(msg);
        errors.add(msg);
        return;
    }
    final Optional<XSModel> xsModelOptional = BackendUtils.getXSModel(ref, repository);
    if (!xsModelOptional.isPresent()) {
        LOGGER.error("no XSModel found");
    }
    XSModel xsModel = xsModelOptional.get();
    XSElementDeclaration elementDeclaration = xsModel.getElementDeclaration(element.getLocalPart(), element.getNamespaceURI());
    if (elementDeclaration == null) {
        String msg = "XSD model claimed to contain declaration for {" + element.getNamespaceURI() + "}" + element.getLocalPart() + ", but it did not.";
        BackendUtils.LOGGER.debug(msg);
        errors.add(msg);
        return;
    }
    // go through the XSD definition and
    XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
    if (!(typeDefinition instanceof XSComplexTypeDefinition)) {
        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: No Complex Type Definition");
        return;
    }
    XSComplexTypeDefinition cTypeDefinition = (XSComplexTypeDefinition) typeDefinition;
    XSParticle particle = cTypeDefinition.getParticle();
    if (particle == null) {
        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Complex type does not contain particles");
        return;
    }
    XSTerm term = particle.getTerm();
    if (!(term instanceof XSModelGroup)) {
        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Not a model group");
        return;
    }
    XSModelGroup modelGroup = (XSModelGroup) term;
    if (modelGroup.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE) {
        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Model group is not a sequence");
        return;
    }
    XSObjectList particles = modelGroup.getParticles();
    int len = particles.getLength();
    boolean everyThingIsASimpleType = true;
    List<PropertyDefinitionKV> list = new ArrayList<>();
    if (len != 0) {
        for (int i = 0; i < len; i++) {
            XSParticle innerParticle = (XSParticle) particles.item(i);
            XSTerm innerTerm = innerParticle.getTerm();
            if (innerTerm instanceof XSElementDeclaration) {
                XSElementDeclaration innerElementDeclaration = (XSElementDeclaration) innerTerm;
                String name = innerElementDeclaration.getName();
                XSTypeDefinition innerTypeDefinition = innerElementDeclaration.getTypeDefinition();
                if (innerTypeDefinition instanceof XSSimpleType) {
                    XSSimpleType xsSimpleType = (XSSimpleType) innerTypeDefinition;
                    String typeNS = xsSimpleType.getNamespace();
                    String typeName = xsSimpleType.getName();
                    if (typeNS.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
                        PropertyDefinitionKV def = new PropertyDefinitionKV();
                        def.setKey(name);
                        // convention at WPD: use "xsd" as prefix for XML Schema Definition
                        def.setType("xsd:" + typeName);
                        list.add(def);
                    } else {
                        everyThingIsASimpleType = false;
                        break;
                    }
                } else {
                    everyThingIsASimpleType = false;
                    break;
                }
            } else {
                everyThingIsASimpleType = false;
                break;
            }
        }
    }
    if (!everyThingIsASimpleType) {
        BackendUtils.LOGGER.debug("XSD does not follow the requirements put by winery: Not all types in the sequence are simple types");
        return;
    }
    // everything went alright, we can add a WPD
    WinerysPropertiesDefinition wpd = new WinerysPropertiesDefinition();
    wpd.setIsDerivedFromXSD(Boolean.TRUE);
    wpd.setElementName(element.getLocalPart());
    wpd.setNamespace(element.getNamespaceURI());
    wpd.setPropertyDefinitions(list);
    ModelUtilities.replaceWinerysPropertiesDefinition(ci, wpd);
    BackendUtils.LOGGER.debug("Successfully generated WPD");
}
Also used : XSTypeDefinition(org.apache.xerces.xs.XSTypeDefinition) XSObjectList(org.apache.xerces.xs.XSObjectList) PropertyDefinitionKV(org.eclipse.winery.model.tosca.extensions.kvproperties.PropertyDefinitionKV) XSParticle(org.apache.xerces.xs.XSParticle) TEntityType(org.eclipse.winery.model.tosca.TEntityType) ArrayList(java.util.ArrayList) WinerysPropertiesDefinition(org.eclipse.winery.model.tosca.extensions.kvproperties.WinerysPropertiesDefinition) XSComplexTypeDefinition(org.apache.xerces.xs.XSComplexTypeDefinition) XSSimpleType(org.apache.xerces.impl.dv.XSSimpleType) XSElementDeclaration(org.apache.xerces.xs.XSElementDeclaration) XSModel(org.apache.xerces.xs.XSModel) XsdImportManager(org.eclipse.winery.repository.backend.xsd.XsdImportManager) XSModelGroup(org.apache.xerces.xs.XSModelGroup) XSTerm(org.apache.xerces.xs.XSTerm) QName(javax.xml.namespace.QName) HasTargetNamespace(org.eclipse.winery.model.tosca.HasTargetNamespace) Namespace(org.eclipse.winery.model.ids.Namespace) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference)

Example 5 with XSTerm

use of org.apache.xerces.xs.XSTerm in project iaf by ibissource.

the class ToXml method getBestMatchingElementPath.

/**
 * @param baseElementDeclaration TODO
 * @param particle
 * @param failureReasons returns the reasons why no match was found
 * @param path in this list the longest list of child elements, that matches the available, is maintained. Null if no matching.
 * @return true when a matching path is found. if false, failureReasons will contain reasons why.
 * @throws SAXException
 */
public boolean getBestMatchingElementPath(XSElementDeclaration baseElementDeclaration, N baseNode, XSParticle particle, List<XSParticle> path, List<String> failureReasons) throws SAXException {
    if (particle == null) {
        throw new NullPointerException("getBestMatchingElementPath particle is null");
    }
    XSTerm term = particle.getTerm();
    if (term == null) {
        throw new NullPointerException("getBestMatchingElementPath particle.term is null");
    }
    if (term instanceof XSModelGroup) {
        XSModelGroup modelGroup = (XSModelGroup) term;
        short compositor = modelGroup.getCompositor();
        XSObjectList particles = modelGroup.getParticles();
        if (log.isTraceEnabled())
            log.trace("getBestMatchingElementPath() modelGroup particles [" + ToStringBuilder.reflectionToString(particles, ToStringStyle.MULTI_LINE_STYLE) + "]");
        switch(compositor) {
            case XSModelGroup.COMPOSITOR_SEQUENCE:
            case XSModelGroup.COMPOSITOR_ALL:
                for (int i = 0; i < particles.getLength(); i++) {
                    XSParticle childParticle = (XSParticle) particles.item(i);
                    if (!getBestMatchingElementPath(baseElementDeclaration, baseNode, childParticle, path, failureReasons)) {
                        return false;
                    }
                }
                return true;
            case XSModelGroup.COMPOSITOR_CHOICE:
                List<XSParticle> bestPath = null;
                List<String> choiceFailureReasons = new LinkedList<String>();
                for (int i = 0; i < particles.getLength(); i++) {
                    XSParticle childParticle = (XSParticle) particles.item(i);
                    List<XSParticle> optionPath = new LinkedList<XSParticle>(path);
                    if (getBestMatchingElementPath(baseElementDeclaration, baseNode, childParticle, optionPath, choiceFailureReasons)) {
                        if (bestPath == null || bestPath.size() < optionPath.size()) {
                            bestPath = optionPath;
                        }
                    }
                }
                if (bestPath == null) {
                    failureReasons.addAll(choiceFailureReasons);
                    return false;
                }
                if (log.isTraceEnabled())
                    log.trace("Replace path with best path of Choice Compositor, size [" + bestPath.size() + "]");
                path.clear();
                path.addAll(bestPath);
                return true;
            default:
                throw new IllegalStateException("getBestMatchingElementPath modelGroup.compositor is not COMPOSITOR_SEQUENCE, COMPOSITOR_ALL or COMPOSITOR_CHOICE, but [" + compositor + "]");
        }
    }
    if (term instanceof XSElementDeclaration) {
        XSElementDeclaration elementDeclaration = (XSElementDeclaration) term;
        String elementName = elementDeclaration.getName();
        if (log.isTraceEnabled())
            log.trace("getBestMatchingElementPath().XSElementDeclaration name [" + elementName + "]");
        if (!hasChild(baseElementDeclaration, baseNode, elementName)) {
            if (isDeepSearch()) {
                if (log.isTraceEnabled())
                    log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] not found, perform deep search");
                try {
                    List<XSParticle> subList = getBestChildElementPath(elementDeclaration, baseNode, true);
                    if (subList != null && !subList.isEmpty()) {
                        path.add(particle);
                        if (log.isTraceEnabled())
                            log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] not found, nested elements found in deep search");
                        return true;
                    }
                    if (log.isTraceEnabled())
                        log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] not found, no nested elements found in deep search");
                } catch (Exception e) {
                    if (log.isTraceEnabled())
                        log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] not found, no nested elements found in deep search: " + e.getMessage());
                    return false;
                }
            }
            if (particle.getMinOccurs() > 0) {
                // if (log.isTraceEnabled()) log.trace("getBestMatchingElementPath().XSElementDeclaration mandatory element ["+elementName+"] not found, path fails, autoInsertMandatory ["+isAutoInsertMandatory()+"]");
                // if (isAutoInsertMandatory()) {
                // path.add(particle);
                // if (log.isTraceEnabled()) log.trace("getBestMatchingElementPath().XSElementDeclaration element ["+elementName+"] not found, nested elements found in deep search");
                // return true;
                // }
                failureReasons.add(MSG_EXPECTED_ELEMENT + " [" + elementName + "]");
                return false;
            }
            if (log.isTraceEnabled())
                log.trace("getBestMatchingElementPath().XSElementDeclaration optional element [" + elementName + "] not found, path continues");
            return true;
        }
        for (XSParticle resultParticle : path) {
            if (elementName.equals(resultParticle.getTerm().getName())) {
                if (log.isTraceEnabled())
                    log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] found but required multiple times");
                failureReasons.add("element [" + elementName + "] required multiple times");
                return false;
            }
        }
        if (log.isTraceEnabled())
            log.trace("getBestMatchingElementPath().XSElementDeclaration element [" + elementName + "] found");
        path.add(particle);
        return true;
    }
    if (term instanceof XSWildcard) {
        XSWildcard wildcard = (XSWildcard) term;
        String processContents;
        switch(wildcard.getProcessContents()) {
            case XSWildcard.PC_LAX:
                processContents = "LAX";
                break;
            case XSWildcard.PC_SKIP:
                processContents = "SKIP";
                break;
            case XSWildcard.PC_STRICT:
                processContents = "STRICT";
                break;
            default:
                throw new IllegalStateException("getBestMatchingElementPath wildcard.processContents is not PC_LAX, PC_SKIP or PC_STRICT, but [" + wildcard.getProcessContents() + "]");
        }
        String namespaceConstraint;
        switch(wildcard.getConstraintType()) {
            case XSWildcard.NSCONSTRAINT_ANY:
                namespaceConstraint = "ANY";
                break;
            case XSWildcard.NSCONSTRAINT_LIST:
                namespaceConstraint = "SKIP " + wildcard.getNsConstraintList();
                break;
            case XSWildcard.NSCONSTRAINT_NOT:
                namespaceConstraint = "NOT " + wildcard.getNsConstraintList();
                break;
            default:
                throw new IllegalStateException("getBestMatchingElementPath wildcard.namespaceConstraint is not ANY, LIST or NOT, but [" + wildcard.getConstraintType() + "]");
        }
        String msg = "term for element [" + baseElementDeclaration.getName() + "] is WILDCARD; namespaceConstraint [" + namespaceConstraint + "] processContents [" + processContents + "]. Please check if the element typed properly in the schema";
        if (isFailOnWildcards()) {
            throw new IllegalStateException(msg + ", or set failOnWildcards=\"false\"");
        }
        log.warn(msg);
        return true;
    }
    throw new IllegalStateException("getBestMatchingElementPath unknown Term type [" + term.getClass().getName() + "]");
}
Also used : XSObjectList(org.apache.xerces.xs.XSObjectList) XSTerm(org.apache.xerces.xs.XSTerm) XSParticle(org.apache.xerces.xs.XSParticle) XSWildcard(org.apache.xerces.xs.XSWildcard) LinkedList(java.util.LinkedList) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException) XSElementDeclaration(org.apache.xerces.xs.XSElementDeclaration) XSModelGroup(org.apache.xerces.xs.XSModelGroup)

Aggregations

XSTerm (org.apache.xerces.xs.XSTerm)9 XSElementDeclaration (org.apache.xerces.xs.XSElementDeclaration)7 XSParticle (org.apache.xerces.xs.XSParticle)7 XSModelGroup (org.apache.xerces.xs.XSModelGroup)6 XSObjectList (org.apache.xerces.xs.XSObjectList)6 XSTypeDefinition (org.apache.xerces.xs.XSTypeDefinition)3 ArrayList (java.util.ArrayList)2 JsonObjectBuilder (javax.json.JsonObjectBuilder)2 QName (javax.xml.namespace.QName)2 XSSimpleType (org.apache.xerces.impl.dv.XSSimpleType)2 XSComplexTypeDefinition (org.apache.xerces.xs.XSComplexTypeDefinition)2 XSModel (org.apache.xerces.xs.XSModel)2 XSWildcard (org.apache.xerces.xs.XSWildcard)2 HasTargetNamespace (org.eclipse.winery.model.tosca.HasTargetNamespace)2 XsdImportManager (org.eclipse.winery.repository.backend.xsd.XsdImportManager)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 JsonArrayBuilder (javax.json.JsonArrayBuilder)1 JsonObject (javax.json.JsonObject)1