/** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, String baseURI) { return bind(xsdStream, encoding, baseURI, true); }
public static SchemaBinding bind(XSModel model, SchemaBindingResolver resolver, boolean processAnnotations) { XsdBinder binder = new XsdBinder(); binder.setProcessAnnotations(processAnnotations); binder.setSchemaResolver(resolver); return binder.parse(model); }
/** * @param schema schema binding the type should be added to * @param element element declaration to be bound * @param minOccurs * @param maxOccurs * @param maxOccursUnbounded * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS. * It will be removed when anonymous type binding in JBossWS is implemented properly. * No one else should use this method.</i> * * <p>This method binds an element declaration and adds it as a global element to the passed in schema binding. */ public static void bindElement(SchemaBinding schema, XSElementDeclaration element, int minOccurs, int maxOccurs, boolean maxOccursUnbounded) { XsdBinder binder = new XsdBinder(schema); ParticleBinding particle = binder.bindElement(element, minOccurs, maxOccurs, maxOccursUnbounded ); schema.addElementParticle(particle); }
/** * @param schema schema binding the type should be added to * @param type type definition to be bound * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS. * It will be removed when anonymous type binding in JBossWS is implemented properly. * No one else should use this method.</i> * * <p>This method binds a type definition and adds it as a global type to the passed in schema binding. */ public static void bindType(SchemaBinding schema, XSTypeDefinition type) { XsdBinder binder = new XsdBinder(schema); TypeBinding typeBinding = binder.bindType(type); schema.addType(typeBinding); }
ModelGroupBinding groupBinding = bindModelGroup(modelGroup); particleBinding.setMaxOccurs(particle.getMaxOccurs()); Object o = peekTypeOrGroup(); if(o instanceof ModelGroupBinding) pushModelGroup(groupBinding); bindModelGroupParticles(modelGroup); popModelGroup(); bindWildcard(particle); break; case XSConstants.ELEMENT_DECLARATION: bindElement( (XSElementDeclaration)term, particle.getMinOccurs(),
if(baseTypeDef != null && !Constants.QNAME_ANYTYPE.equals(typeName)) baseType = bindType(baseTypeDef); TypeBinding simpleType = bindSimpleType(type.getSimpleType()); binding.setSimpleType(simpleType); attrBinding = bindAttribute(attr); binding.addAttribute(attrBinding); if(hasOnlyIdAttrs && !Constants.QNAME_ID.equals(attrBinding.getType().getQName())) if(particle != null) pushType(binding); bindParticle(particle); popType(); addXOPInclude(binding, schema);
bindGlobalGroup(groupDef); bindGlobalGroupParticles(groupDef.getModelGroup()); if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace())) bindType(type); bindElement(element, 1, 0, false);
private TypeBinding bindType(XSTypeDefinition type) { TypeBinding binding; switch(type.getTypeCategory()) { case XSTypeDefinition.SIMPLE_TYPE: binding = bindSimpleType((XSSimpleTypeDefinition)type); break; case XSTypeDefinition.COMPLEX_TYPE: binding = bindComplexType((XSComplexTypeDefinition)type); break; default: throw new JBossXBRuntimeException("Unexpected type category: " + type.getTypeCategory()); } return binding; }
/** * Creates a new instance of the binder the user can use to tune * configuration before parsing the XSD. * * @return a new instance of the XsdBinder */ public static XsdBinder newInstance() { return new XsdBinder(); }
private void bindGlobalGroup(XSModelGroupDefinition groupDef) { QName groupName = new QName(groupDef.getNamespace(), groupDef.getName()); XSModelGroup group = groupDef.getModelGroup(); ModelGroupBinding groupBinding = bindModelGroup(group); groupBinding.setQName(groupName); sharedElements.addGlobalGroup(group, groupBinding); schema.addGroup(groupName, groupBinding); }
/** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, SchemaBindingResolver resolver) { return bind(xsdStream, encoding, resolver, true); }
public static SchemaBinding bind(XSModel model, SchemaBindingResolver resolver) { return bind(model,resolver, true); }
/** * Create a SchemaBinding from and xsd string. * * @param xsd - xsd string * @param encoding - optional string encoding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsd, String encoding) { return bind(xsd, encoding, new DefaultSchemaResolver()); }
public void marshal(Reader xsdReader, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException, ParserConfigurationException { SchemaBinding model = XsdBinder.bind(xsdReader, null, schemaResolver); marshallInternal(root, model, writer); }
public void marshal(String xsdURL, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException { SchemaBinding model = XsdBinder.bind(xsdURL, schemaResolver); marshallInternal(root, model, writer); }
/** * Create a SchemaBinding from and xsd url/uri. * * @param xsdUrl * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsdUrl, SchemaBindingResolver resolver) { XSModel model = Util.loadSchema(xsdUrl, resolver); return bind(model, resolver); }
public static SchemaBinding bind(InputStream xsdStream, String encoding) { return bind(xsdStream, encoding, new DefaultSchemaResolver()); }
public static SchemaBinding bind(Reader xsdReader, String encoding) { return bind(xsdReader, encoding, new DefaultSchemaResolver()); }
/** * Create a SchemaBinding from and xsd string. * * @param xsd - xsd string * @param encoding - optional string encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsd, String encoding, SchemaBindingResolver resolver) { XSModel model = Util.loadSchema(xsd, encoding); return bind(model, resolver); }
/** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @param processAnnotations whether to process annotations * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, SchemaBindingResolver resolver, boolean processAnnotations) { XSModel model = Util.loadSchema(xsdStream, encoding, resolver); return bind(model, resolver, processAnnotations); }