Examples of SchemaBinding


Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

            if(xmlType == null)
            {
               fail("The root type is expected to be annotated with XmlType: " + rootType);
            }
           
            SchemaBinding schema = JBossXBBuilder.build(rootType);
            String typeNs = xmlType.namespace();
            if(typeNs.equals(JBossXmlConstants.DEFAULT))
            {
               typeNs = (String) schema.getNamespaces().iterator().next();
            }
            QName typeName = new QName(typeNs, xmlType.name());
            TypeBinding type = schema.getType(typeName);
            if(type == null)
            {
               fail("Type " + typeName + " not found in the schema!");
            }
           
            schema.addElement(rootQName, type);
           
            return schema;
         }

         public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation)
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

     
      // TODO: arg
      String targetNamespace = "http://www.jboss.com/xml/ns/javaee";
      String version = "5.0";
     
      SchemaBinding binding = JBossXBBuilder.build(root);
     
      println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
     
      println("<xsd:schema xmlns=\"http://www.w3.org/2001/XMLSchema\"");
     
      Map<String, String> nsByPrefix = getNsByPrefix(binding);
      for(String prefix : nsByPrefix.keySet())
      {
         String namespace = binding.getNamespace(prefix);
         println("   xmlns:" + prefix + "=\"" + namespace + "\"");
         prefixByNs.put(namespace, prefix);
      }
      println("   targetNamespace=\"" + targetNamespace + "\"");
      println("   version=\"" + version + "\"");
      println("   elementFormDefault=\"qualified\"");
      println("   >");
     
      indent++;
     
      Iterator<ParticleBinding> particles = binding.getElementParticles();
      while(particles.hasNext())
      {
         ParticleBinding particle = particles.next();
         dumpParticle(particle);
      }
     
      Iterator<TypeBinding> types = binding.getTypes();
      while(types.hasNext())
      {
         TypeBinding type = types.next();
         if(type.getQName().getNamespaceURI().equals(targetNamespace))
            dumpType(type);
      }
     
      Iterator<ModelGroupBinding> groups = binding.getGroups();
      while(groups.hasNext())
      {
         ModelGroupBinding modelGroup = groups.next();
         dumpModelGroup(modelGroup);
      }
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

public class ServerMetaDataUniTestCase extends TestCase
{

   public void test() throws Exception
   {
      SchemaBinding schema = JBossXBBuilder.build(ServerMetaData.class);
      Unmarshaller u = UnmarshallerFactory.newInstance().newUnmarshaller();
      u.setSchemaValidation(false);
      u.setValidation(false);
      u.setEntityResolver(new JBossEntityResolver());
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

   public EjbJar21MetaData getEJBMetaData(InputStream ejbJarXml)
      throws JBossXBException
   {
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      SchemaBinding schema = JBossXBBuilder.build(EjbJar21MetaData.class);
      JBossEntityResolver entityResolver = new JBossEntityResolver();
      unmarshaller.setEntityResolver(entityResolver);

      return (EjbJar21MetaData) unmarshaller.unmarshal(ejbJarXml, schema);
   }
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

   public WebMetaData getWebMetaData(InputStream webxml)
      throws JBossXBException
   {
      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      SchemaBinding schema = JBossXBBuilder.build(Web24MetaData.class);
      JBossEntityResolver entityResolver = new JBossEntityResolver();
      unmarshaller.setEntityResolver(entityResolver);

      return (WebMetaData) unmarshaller.unmarshal(webxml, schema);
   }
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

   extends TestCase
{
   public void testMbeanService() throws Exception
   {
      InputStream is = getResource("xml/mbeanserver/mbean-service_1_0.xsd");
      SchemaBinding schemaBinding = XsdBinder.bind(is, null);
      schemaBinding.setIgnoreUnresolvedFieldOrClass(true);
      schemaBinding.setSchemaResolver(new SchemaBindingResolver()
      {
         public String getBaseURI()
         {
            throw new UnsupportedOperationException("getBaseURI is not implemented.");
         }

         public void setBaseURI(String baseURI)
         {
            throw new UnsupportedOperationException("setBaseURI is not implemented.");
         }

         public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
         {
            try
            {
               if("urn:jboss:login-config2".equals(nsUri))
               {
                  InputStream is = getResource("xml/mbeanserver/login-config2.xsd");
                  SchemaBinding schemaBinding = XsdBinder.bind(is, null, baseURI);
                  schemaBinding.setSchemaResolver(this);
                  return schemaBinding;
               }
               else if("urn:jboss:user-roles".equals(nsUri))
               {
                  InputStream is = getResource("xml/mbeanserver/user-roles.xsd");
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

   extends TestCase
{
   public void testMain() throws Exception
   {
      URL url = getResource("xml/naming/jndi-binding-service_1_0.xsd");
      SchemaBinding schemaBinding = XsdBinder.bind(url.toString());
      schemaBinding.setIgnoreUnresolvedFieldOrClass(false);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();

      URL xml = getResource("xml/naming/testBindings.xml");
      JNDIBindings bindings = (JNDIBindings)unmarshaller.unmarshal(xml.openStream(), schemaBinding);
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

      }
   }

   public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
   {
      SchemaBinding result = bindings.get(nsUri);
      if (result == null)
         throw new RuntimeException("Schema not bound: " + nsUri + " available: " + bindings.keySet());
      return result;
   }
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

         if(typeBaseQName == null)
         {
            typeBaseQName = elementName;
         }

         SchemaBinding schemaBinding = type.getSchemaBinding();
         PackageMetaData jaxbPackage = schemaBinding == null ? null : schemaBinding.getPackageMetaData();
         String pkg = jaxbPackage == null ?
            Util.xmlNamespaceToJavaPackage(typeBaseQName.getNamespaceURI()) :
            jaxbPackage.getName();
         localClassName = Util.xmlNameToClassName(typeBaseQName.getLocalPart(), element.getSchema().isIgnoreLowLine());
         if(pkg != null && pkg.length() > 0)
View Full Code Here

Examples of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

    * @return the constructed {@code ACLConfiguration} object that contains the configured ACLs.
    */
   public static ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
   {
      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaName), null);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      try
      {
         ACLConfiguration configuration = (ACLConfiguration) unmarshaller.unmarshal(aclConfigFileStream, schema);
         return configuration;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.