Package org.apache.ws.commons.schema

Examples of org.apache.ws.commons.schema.XmlSchemaAny


                    elementOrderMap.put(xsElt, new Integer(i));
                }

                //handle xsd:any ! We place an OMElement (or an array of OMElements) in the generated class
            } else if (item instanceof XmlSchemaAny) {
                XmlSchemaAny any = (XmlSchemaAny) item;
                processedElementTypeMap.put(new QName(ANY_ELEMENT_FIELD_NAME),any);
                //any can also be inside a sequence
                if (order) {
                    elementOrderMap.put(any, new Integer(i));
                }
                //we do not register the array status for the any type
                processedElementArrayStatusMap.put(any,isArray(any) ? Boolean.TRUE : Boolean.FALSE);
            } else {
                //there may be other types to be handled here. Add them
                //when we are ready
            }


        }

        // loop through the processed items and add them to the matainf object
        Iterator processedElementsIterator = processedElementArrayStatusMap.keySet().iterator();
        int startingItemNumberOrder = metainfHolder.getOrderStartPoint();
        while (processedElementsIterator.hasNext()) {
            Object child = processedElementsIterator.next();

            // process the XmlSchemaElement
            if (child instanceof XmlSchemaElement){
                XmlSchemaElement elt = (XmlSchemaElement) child;
                String clazzName;
                QName referencedQName;

                if (elt.getQName()!=null){
                    clazzName = (String) processedElementTypeMap.get(elt.getQName());
                    referencedQName = elt.getQName();
                    metainfHolder.registerMapping(referencedQName,
                            elt.getSchemaType()!=null?elt.getSchemaType().getQName():elt.getSchemaTypeName(), //always get the schema type name from the schema it-self
                            clazzName,
                            ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue() ?
                                    SchemaConstants.ARRAY_TYPE :
                                    SchemaConstants.ELEMENT_TYPE);

                }else{ //probably this is referenced
                    referencedQName = elt.getRefName();
                    boolean arrayStatus = ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue();
                    clazzName = findRefClassName(referencedQName,arrayStatus);
                    metainfHolder.registerMapping(referencedQName,
                            parentSchema.getElementByName(referencedQName).getSchemaTypeName()
                            , clazzName,
                            arrayStatus ?
                                    SchemaConstants.ARRAY_TYPE :
                                    SchemaConstants.ELEMENT_TYPE);
                }



                //register the occurence counts
                metainfHolder.addMaxOccurs(referencedQName, elt.getMaxOccurs());
                metainfHolder.addMinOccurs(referencedQName, elt.getMinOccurs());
                //we need the order to be preserved. So record the order also
                if (order) {
                    //record the order in the metainf holder
                    Integer integer = (Integer) elementOrderMap.get(elt);
                    metainfHolder.registerQNameIndex(referencedQName,
                            startingItemNumberOrder + integer.intValue());
                }

                //get the nillable state and register that on the metainf holder
                if (localNillableList.contains(elt.getQName())){
                    metainfHolder.registerNillableQName(elt.getQName());
                }

                //get the binary state and add that to the status map
                if (isBinary(elt)){
                    metainfHolder.addtStatus(elt.getQName(),
                           SchemaConstants.BINARY_TYPE);
                }
                // process the XMLSchemaAny
            }else if (child instanceof XmlSchemaAny){
                XmlSchemaAny any = (XmlSchemaAny)child;

                //since there is only one element here it does not matter
                //for the constant. However the problem occurs if the users
                //uses the same name for an element decalration
                QName anyElementFieldName = new QName(ANY_ELEMENT_FIELD_NAME);

                //this can be an array or a single element
                boolean isArray =  ((Boolean) processedElementArrayStatusMap.get(any)).booleanValue();
                metainfHolder.registerMapping(anyElementFieldName,
                        null,
                        isArray?DEFAULT_CLASS_ARRAY_NAME:DEFAULT_CLASS_NAME,
                        SchemaConstants.ANY_TYPE);
                //if it's an array register an extra status flag with the system
                if (isArray){
                    metainfHolder.addtStatus(anyElementFieldName,
                            SchemaConstants.ARRAY_TYPE);
                }
                metainfHolder.addMaxOccurs(anyElementFieldName,any.getMaxOccurs());
                metainfHolder.addMinOccurs(anyElementFieldName,any.getMinOccurs());

                if (order) {
                    //record the order in the metainf holder for the any
                    Integer integer = (Integer) elementOrderMap.get(any);
                    metainfHolder.registerQNameIndex(anyElementFieldName,
View Full Code Here


                    // if this is an instance of xs:any, then there is no part name for it. Using ANY_ELEMENT_FIELD_NAME
                    // for it for now

                    //we have to handle both maxoccurs 1 and maxoccurs > 1 situation
                    XmlSchemaAny xmlSchemaAny = (XmlSchemaAny)item;

                    partNameList.add(
                            WSDLUtil.getPartQName(opName.getLocalPart(),
                                                  qnameSuffix,
                                                  Constants.ANY_ELEMENT_FIELD_NAME));
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchemaAny

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.