Package com.sun.xml.internal.bind.v2.runtime.unmarshaller

Examples of com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext


                        if(ep.isCollectionNillable()) {
                            e.nillable(true);
                        }
                        writeOccurs(e,!ep.isCollectionRequired(),repeated);

                        ComplexType p = e.complexType();
                        choice.write(p);
                    }
                };
            } else {// non-wrapped
                return choice;
View Full Code Here


                        elementFormDefault.writeForm(e,ename);
                        if(rp.isCollectionNillable())
                            e.nillable(true);
                        writeOccurs(e,true,repeated);

                        ComplexType p = e.complexType();
                        choice.write(p);
                    }
                };
            } else { // unwrapped
                return choice;
View Full Code Here

                    if(mp.isCollectionNillable())
                        e.nillable(true);

                    e = e.name(ename.getLocalPart());
                    writeOccurs(e,isOptional,repeated);
                    ComplexType p = e.complexType();

                    // TODO: entry, key, and value are always unqualified. that needs to be fixed, too.
                    // TODO: we need to generate the corresponding element declaration, if they are qualified
                    e = p.sequence().element();
                    e.name("entry").minOccurs(0).maxOccurs("unbounded");

                    ExplicitGroup seq = e.complexType().sequence();
                    writeKeyOrValue(seq, "key", mp.getKeyType());
                    writeKeyOrValue(seq, "value", mp.getValueType());
View Full Code Here

                    // TODO: entry, key, and value are always unqualified. that needs to be fixed, too.
                    // TODO: we need to generate the corresponding element declaration, if they are qualified
                    e = p.sequence().element();
                    e.name("entry").minOccurs(0).maxOccurs("unbounded");

                    ExplicitGroup seq = e.complexType().sequence();
                    writeKeyOrValue(seq, "key", mp.getKeyType());
                    writeKeyOrValue(seq, "value", mp.getValueType());
                }
            };
        }
View Full Code Here

                schema._pcdata(newline);

                // refer to other schemas
                for( Namespace n : depends ) {
                    Import imp = schema._import();
                    if(n.uri.length()!=0)
                        imp.namespace(n.uri);
                    String refSystemId = systemIds.get(n);
                    if(refSystemId!=null && !refSystemId.equals("")) {
                        // "" means implied. null if the SchemaOutputResolver said "don't generate!"
                        imp.schemaLocation(relativize(refSystemId,result.getSystemId()));
                    }
                    schema._pcdata(newline);
                }
                if(useSwaRef) {
                    schema._import().namespace(WellKnownNamespace.SWA_URI).schemaLocation("http://ws-i.org/profiles/basic/1.1/swaref.xsd");
View Full Code Here

                        TypeRef<T,C> t = ep.getTypes().get(0);
                        LocalElement e = parent.element();
                        e.block(); // we will write occurs later
                        QName tn = t.getTagName();
                        e.name(tn.getLocalPart());
                        List lst = e.simpleType().list();
                        writeTypeRef(lst,t, "itemType");
                        elementFormDefault.writeForm(e,tn);
                        writeOccurs(e,isOptional||!ep.isRequired(),repeated);
                    }
                };
View Full Code Here

            //   <attribute name="foo" type="xs:int"/>
            // </>
            //
            // or it could also be an in-lined type (attr ref)
            //
            LocalAttribute localAttribute = attr.attribute();

            final String attrURI = ap.getXmlName().getNamespaceURI();
            if (attrURI.equals("") /*|| attrURI.equals(uri) --- those are generated as global attributes anyway, so use them.*/) {
                localAttribute.name(ap.getXmlName().getLocalPart());

                writeAttributeTypeRef(ap, localAttribute);

                attributeFormDefault.writeForm(localAttribute,ap.getXmlName());
            } else { // generate an attr ref
                localAttribute.ref(ap.getXmlName());
            }

            if(ap.isRequired()) {
                // TODO: not type safe
                localAttribute.use("required");
            }
        }
View Full Code Here

         * writes the schema definition for the given array class
         */
        private void writeArray(ArrayInfo<T, C> a, Schema schema) {
            ComplexType ct = schema.complexType().name(a.getTypeName().getLocalPart());
            ct._final("#all");
            LocalElement le = ct.sequence().element().name("item");
            le.type(a.getItemType().getTypeName());
            le.minOccurs(0).maxOccurs("unbounded");
            le.nillable(true);
            ct.commit();
        }
View Full Code Here

        private Tree handleElementProp(final ElementPropertyInfo<T,C> ep) {
            if (ep.isValueList()) {
                return new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        TypeRef<T,C> t = ep.getTypes().get(0);
                        LocalElement e = parent.element();
                        e.block(); // we will write occurs later
                        QName tn = t.getTagName();
                        e.name(tn.getLocalPart());
                        List lst = e.simpleType().list();
                        writeTypeRef(lst,t, "itemType");
                        elementFormDefault.writeForm(e,tn);
                        writeOccurs(e,isOptional||!ep.isRequired(),repeated);
                    }
                };
            }

            ArrayList<Tree> children = new ArrayList<Tree>();
            for (final TypeRef<T,C> t : ep.getTypes()) {
                children.add(new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        LocalElement e = parent.element();

                        QName tn = t.getTagName();

                        if(canBeDirectElementRef(t,tn) || (!tn.getNamespaceURI().equals(uri) && tn.getNamespaceURI().length()>0)) {
                            e.ref(tn);
                        } else {
                            e.name(tn.getLocalPart());
                            writeTypeRef(e,t, "type");
                            elementFormDefault.writeForm(e,tn);
                        }

                        if (t.isNillable()) {
                            e.nillable(true);
                        }
                        if(t.getDefaultValue()!=null)
                            e._default(t.getDefaultValue());
                        writeOccurs(e,isOptional,repeated);
                    }
                });
            }

            final Tree choice = Tree.makeGroup(GroupKind.CHOICE, children)
                    .makeOptional(!ep.isRequired())
                    .makeRepeated(ep.isCollection()); // see Spec table 8-13


            final QName ename = ep.getXmlName();
            if (ename != null) { // wrapped collection
                return new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        LocalElement e = parent.element();
                        if(ename.getNamespaceURI().length()>0) {
                            if (!ename.getNamespaceURI().equals(uri)) {
                                // TODO: we need to generate the corresponding element declaration for this
                                // table 8-25: Property/field element wrapper with ref attribute
                                e.ref(new QName(ename.getNamespaceURI(), ename.getLocalPart()));
                                return;
                            }
                        }
                        e.name(ename.getLocalPart());
                        elementFormDefault.writeForm(e,ename);

                        if(ep.isCollectionNillable()) {
                            e.nillable(true);
                        }
                        writeOccurs(e,!ep.isCollectionRequired(),repeated);

                        ComplexType p = e.complexType();
                        choice.write(p);
                    }
                };
            } else {// non-wrapped
                return choice;
View Full Code Here

            ArrayList<Tree> children = new ArrayList<Tree>();

            for (final Element<T,C> e : rp.getElements()) {
                children.add(new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        LocalElement eref = parent.element();

                        boolean local=false;

                        QName en = e.getElementName();
                        if(e.getScope()!=null) {
                            // scoped. needs to be inlined
                            boolean qualified = en.getNamespaceURI().equals(uri);
                            boolean unqualified = en.getNamespaceURI().equals("");
                            if(qualified || unqualified) {
                                // can be inlined indeed

                                // write form="..." if necessary
                                if(unqualified) {
                                    if(elementFormDefault.isEffectivelyQualified)
                                        eref.form("unqualified");
                                } else {
                                    if(!elementFormDefault.isEffectivelyQualified)
                                        eref.form("qualified");
                                }

                                local = true;
                                eref.name(en.getLocalPart());

                                // write out type reference
                                if(e instanceof ClassInfo) {
                                    writeTypeRef(eref,(ClassInfo<T,C>)e,"type");
                                } else {
                                    writeTypeRef(eref,((ElementInfo<T,C>)e).getContentType(),"type");
                                }
                            }
                        }
                        if(!local)
                            eref.ref(en);
                        writeOccurs(eref,isOptional,repeated);
                    }
                });
            }

            final WildcardMode wc = rp.getWildcard();
            if( wc != null ) {
                children.add(new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        Any any = parent.any();
                        final String pcmode = getProcessContentsModeName(wc);
                        if( pcmode != null ) any.processContents(pcmode);
                        any.namespace("##other");
                        writeOccurs(any,isOptional,repeated);
                    }
                });
            }


            final Tree choice = Tree.makeGroup(GroupKind.CHOICE, children).makeRepeated(rp.isCollection()).makeOptional(!rp.isRequired());

            final QName ename = rp.getXmlName();

            if (ename != null) { // wrapped
                return new Tree.Term() {
                    protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
                        LocalElement e = parent.element().name(ename.getLocalPart());
                        elementFormDefault.writeForm(e,ename);
                        if(rp.isCollectionNillable())
                            e.nillable(true);
                        writeOccurs(e,true,repeated);

                        ComplexType p = e.complexType();
                        choice.write(p);
                    }
                };
            } else { // unwrapped
                return choice;
View Full Code Here

TOP

Related Classes of com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext

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.