Package oracle.xml.parser.schema

Examples of oracle.xml.parser.schema.XSDNode


     * @param childName - the node name to be located
     * @return the child node with name matching 'childName', null if not found
     */
    protected XSDNode findChildNode(XSDElement parent, String childName) {
        XSDNode[] children;
        XSDNode node = null;
        boolean successful = false;

        // get the parent node's children
        children = ((XSDComplexType)parent.getType()).getElementSet();

        // iterate over child nodes looking for the child
        for (int i = 0; i < children.length; i++) {
            node = children[i];

            if (node.getName().equals(childName)) {
                successful = true;
                break;
            }
        }

View Full Code Here


        // set the schema to be validated against
        validator.setXMLProperty(XSDValidator.FIXED_SCHEMA, xmlSchema);

        // set the node to be validated against
        XSDNode xsdNode = getNodeFromSchemaReference(xmlSchema, schemaReference, nsResolver);

        // if xsdNode is null, the schema context string is empty or the target could not be found
        if (xsdNode == null) {
            validator.setXMLProperty(XSDNode.ROOT_NODE, null);
        }
View Full Code Here

        if (schemaRef.getType() == XMLSchemaReference.COMPLEX_TYPE) {
            return xmlSchema.getType(namespace, nodeName, XSDConstantValues.TYPE);
        }

        // handle elements
        XSDNode node = xmlSchema.getElement(namespace, nodeName);

        // loop through schema context tokens - 'node' will contain the target when completed
        while (nodes.hasMoreTokens()) {
            node = findChildNode((XSDElement)node, nodes.nextToken());
View Full Code Here

     * @param childName - the node name to be located
     * @return the child node with name matching 'childName', null if not found
     */
    protected XSDNode findChildNode(XSDElement parent, String childName) {
        XSDNode[] children;
        XSDNode node = null;
        boolean successful = false;

        // get the parent node's children
        children = ((XSDComplexType)parent.getType()).getElementSet();

        // iterate over child nodes looking for the child
        for (int i = 0; i < children.length; i++) {
            node = children[i];

            if (node.getName().equals(childName)) {
                successful = true;
                break;
            }
        }

View Full Code Here

        // set the schema to be validated against
        validator.setXMLProperty(XSDValidator.FIXED_SCHEMA, xmlSchema);

        // set the node to be validated against
        XSDNode xsdNode = getNodeFromSchemaReference(xmlSchema, schemaReference, nsResolver);

        // if xsdNode is null, the schema context string is empty or the target could not be found
        if (xsdNode == null) {
            validator.setXMLProperty(XSDNode.ROOT_NODE, null);
        }
View Full Code Here

        if (schemaRef.getType() == XMLSchemaReference.COMPLEX_TYPE) {
            return xmlSchema.getType(namespace, nodeName, XSDConstantValues.TYPE);
        }

        // handle elements
        XSDNode node = xmlSchema.getElement(namespace, nodeName);

        // loop through schema context tokens - 'node' will contain the target when completed
        while (nodes.hasMoreTokens()) {
            node = findChildNode((XSDElement)node, nodes.nextToken());
View Full Code Here

     * @param childName - the node name to be located
     * @return the child node with name matching 'childName', null if not found
     */
    protected XSDNode findChildNode(XSDElement parent, String childName) {
        XSDNode[] children;
        XSDNode node = null;
        boolean successful = false;

        // get the parent node's children
        children = ((XSDComplexType)parent.getType()).getElementSet();

        // iterate over child nodes looking for the child
        for (int i = 0; i < children.length; i++) {
            node = children[i];

            if (node.getName().equals(childName)) {
                successful = true;
                break;
            }
        }

View Full Code Here

    private StructureDef buildStructure() throws XSDException {
        // build StructureDefinition
        final StructureDef rootStruct = new StructureDef(getQualifiedName());
        for (DataControlDefinitionNode defNode : defNodes) {
            // try to find root data node as XSD Element or otherwise as XSD ComplexType
            XSDNode rootDataNode = loadRootDataNode(defNode);
            if (rootDataNode == null) {
                // failure at design time has already been shown as dialog. Quit silently
                return null;
            }

            // have StructureProvider build a StructureDef for root data node (XSD Element or ComplexType)
            StructureProvider structProv = defNode.getProviderInstance(StructureProvider.class);
            TypeMapper typeMapper = defNode.getProviderInstance(TypeMapper.class);
            MovableStructureDefinition structDef =
                structProv.buildStructure(rootDataNode, getReturnStructName(rootStruct, defNode), typeMapper);

            // create MethodDef with StructureDef from StructureProvider as return value
            final MethodDef method = new MethodDef(defNode.getDatacontrolOperation(), rootStruct);
            rootStruct.addMethod(method);

            // add parameters to method-definition if data provider has dynamic parameters
            {
                final Set<DynamicParameter> dynamicParams = defNode.getDynamicParams();
                if (dynamicParams != null) {
                    for (DynamicParameter dynpar : dynamicParams) {
                        method.addParameter(dynpar.getName(), dynpar.getJavaType());
                    }
                }
            }

            // link StructureDef to MethodDef using a MethodReturnDef
            final MethodReturnDef methodReturn =
                new MethodReturnDef(rootDataNode.getName(), structDef, method, COLLECTION_FALSE,
                                    SCALAR_COLLECTION_FALSE);
            structDef.setParent(methodReturn);
            method.setReturnType(methodReturn);

            // apply customizations to the structure
View Full Code Here

    }

    private XSDNode loadRootDataNode(DataControlDefinitionNode defNode) throws XSDException {
        final XMLSchema schema = defNode.getSchema();
        // try to find root data node as XSD Element or otherwise as XSD ComplexType
        XSDNode rootDataNode = schema == null ? null : schema.getElement(schema.getSchemaTargetNS(), defNode.getRoot());
        if (rootDataNode == null) {
            rootDataNode = schema == null ? null : schema.getType(schema.getSchemaTargetNS(), defNode.getRoot());
        }
        if (rootDataNode == null) {
            // both XSD Element and ComplexType not found. Reporting to the user.
View Full Code Here

     * @param element
     * @param parent
     * @return AttributeDef bij simpleTypes of AccessorDef bij complexTypes
     */
    protected void resolveElement(final XSDElement element, final MovableStructureDef parent) {
        XSDNode type = element.getType();
        boolean noType = false;
        boolean explicitAnyType = false;
        if (isAnyType(type)) {
            if (hasTypeAttribute(element)) {
                explicitAnyType = true;
            } else { // elementen zonder type krijgen een XSDComplexType anyType. Deze negeren
                // we om onderscheid te kunnen maken met elementen die expliciet op
                // type=anyType zijn gezet
                noType = true;
                type = null;
            }
        }
        final String safeElementName = Utility.normalizeString(element.getName());
        final boolean collection = isCollection(element);

        if (type instanceof XSDSimpleType || noType || explicitAnyType) { // simpletype, geen type (dus string) en anytype moeten allemaal
            // attribuut worden
            AccessorDef collAccessor = null;
            MovableStructureDef attrParent = parent;
            LeafNodeType leafNodeType = LeafNodeType.ELEMENT;
            if (collection) { // collectie van attributen kan niet, dus collection accessor maken met
                // "fake" structure
                // TODO: beter beschrijven scalar collection??
                collAccessor =
                    createDCAccessor(safeElementName + SCALAR_COLLECTION_POSTFIX, parent, collection,
                                     SCALAR_COLLECTION_TRUE);
                addAccessorProperties(collAccessor, element);
                //createCompound(type, accessorDef); // maak StructureDefinition
                // maak StructureDefinition met enkel attribuut
                final MovableStructureDef collStructure = createDCStructure(collAccessor);
                // attribute voor element laten aanmaken in nieuwe structureDef en niet
                // in gegeven parent (waar nu een accessor en andere structure in
                // geplaatst zijn)
                attrParent = collStructure;
                leafNodeType = LeafNodeType.SCALAR_COLLECTION_ELEMENT;
            }
            // TODO: kunnen we code delen met resolveElement bij een simpleType???
            // TODO: kunnen we code delen met collectie van simpleType???
            // attribuut maken en deze toe voegen aan gegeven parent of "fake"
            // parent die we net gemaakt hebben igv collectie
            // wanneer expliciet anyType is opgegeven dan hele XML element exposen
            if (explicitAnyType) {
                final AttributeDef attrDef = createDCAttribute(safeElementName, attrParent, "org.w3c.dom.Element");
                addAttributeProperties(attrDef, element, type.getQName(), leafNodeType);
            } else {
                final XSDSimpleType simpleType = (XSDSimpleType) type;
                final AttributeDef attrDef =
                    createDCAttribute(safeElementName, attrParent, getTypeMapper().getJavaType(simpleType));
                addAttributeProperties(attrDef, element, getTypeMapper().getMappableType(simpleType), leafNodeType);
            }
        } else if (type instanceof XSDComplexType) { // complexType (niet anyType) als accessor met structure maken
            final XSDComplexType complexType = (XSDComplexType) type;
            final AccessorDef accessorDef =
                createDCAccessor(safeElementName, parent, collection, SCALAR_COLLECTION_FALSE);
            addAccessorProperties(accessorDef, element);
            final MovableStructureDef structDef =
                resolveComplexType(complexType, accessorDef); // maak StructureDefinition
            addStructureProperties(structDef, complexType);
        } else {
            throw new UnsupportedOperationException("XSDElement with type " + type.getClass().getName());
        }

    }
View Full Code Here

TOP

Related Classes of oracle.xml.parser.schema.XSDNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.