@Override protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { Particle c = kind.write(parent); writeOccurs(c,isOptional,repeated); for (Tree child : children) { child.write(c,false,false); } } }
/** * Given the effective 'form' value, write (or suppress) the @form attribute * on the generated XML. */ public void writeForm(LocalElement e, QName tagName) { _writeForm(e,tagName); }
/** * Returns "T+" from "T". * * @param really * if false this method becomes no-op. This is so that we can write * the caller fluently. */ Tree makeRepeated(boolean really) { return really?new Repeated(this) :this; }
/** * Writes inside the given complex type. */ protected void write(TypeDefParticle ct) { if(canBeTopLevel()) write(ct._cast(ContentModelContainer.class), false, false); else // need a dummy wrapper new Group(GroupKind.SEQUENCE,this).write(ct); }
private static String calculateRelativePath(String uri, String base, boolean fileUrl) { // if this is a file URL (very likely), and if this is on a case-insensitive file system, // then treat it accordingly. boolean onWindows = File.pathSeparatorChar==';'; if (base == null) { return null; } if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); } }
/** * Adds an additional element declaration. * * @param tagName * The name of the element declaration to be added. * @param type * The type this element refers to. * Can be null, in which case the element refers to an empty anonymous complex type. */ public void add( QName tagName, boolean isNillable, NonElement<T,C> type ) { if(type!=null && type.getType()==navigator.ref(CompositeStructure.class)) return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema Namespace n = getNamespace(tagName.getNamespaceURI()); n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type)); // search for foreign namespace references if(type!=null) n.addDependencyTo(type.getTypeName()); }
@Override public void generateEpisode(Result output) { if(output==null) throw new IllegalArgumentException(); createSchemaGenerator().writeEpisodeFile(ResultFactory.createSerializer(output)); }
public XmlSchemaGenerator( Navigator<T,C,F,M> navigator, TypeInfoSet<T,C,F,M> types ) { this.navigator = navigator; this.types = types; this.stringType = types.getTypeInfo(navigator.ref(String.class)); this.anyType = types.getAnyTypeInfo(); // populate the object for( ClassInfo<T,C> ci : types.beans().values() ) add(ci); for( ElementInfo<T,C> ei1 : types.getElementMappings(null).values() ) add(ei1); for( EnumLeafInfo<T,C> ei : types.enums().values() ) add(ei); for( ArrayInfo<T,C> a : types.arrays().values()) add(a); }
@Override protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { body.write(parent,true,repeated); } }
@Override boolean isNullable() { return body.isNullable(); }
/** * Returns "T?" from "T". * * @param really * if false this method becomes no-op. This is so that we can write * the caller fluently. */ Tree makeOptional(boolean really) { return really?new Optional(this) :this; }
@Override public String toString() { return format(); }
/** * Gets the constant the corresponds to the given {@link XmlNsForm}. */ public static Form get(XmlNsForm xnf) { for (Form v : values()) { if(v.xnf==xnf) return v; } throw new IllegalArgumentException(); }
private Namespace getNamespace(String uri) { Namespace n = namespaces.get(uri); if(n==null) namespaces.put(uri,n=new Namespace(uri)); return n; }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated * @param typeRef */ private boolean generateSwaRefAdapter(NonElementRef<T,C> typeRef) { return generateSwaRefAdapter(typeRef.getSource()); }
/** * Adds a new element to the list of elements to be written. */ public void add( ElementInfo<T,C> elem ) { assert elem!=null; @SuppressWarnings("UnusedAssignment") boolean nillable = false; // default value QName name = elem.getElementName(); Namespace n = getNamespace(name.getNamespaceURI()); ElementInfo ei; if (elem.getScope() != null) { // (probably) never happens ei = this.types.getElementInfo(elem.getScope().getClazz(), name); } else { ei = this.types.getElementInfo(null, name); } XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class); if (xmlElem == null) { nillable = false; } else { nillable = xmlElem.nillable(); } n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); // search for foreign namespace references n.processForeignNamespaces(elem.getProperty(), 1); }
public void writeForm(LocalAttribute a, QName tagName) { _writeForm(a,tagName); }
@Override protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { body.write(parent,isOptional,true); } }
@Override boolean isNullable() { if(kind== GroupKind.CHOICE) { for (Tree t : children) { if(t.isNullable()) return true; } return false; } else { for (Tree t : children) { if(!t.isNullable()) return false; } return true; } }