Package org.jboss.xb.binding.sunday.unmarshalling

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


      if(typeBase == null)
      {
         typeBase = element.getQName();
      }

      SchemaBinding schema = element.getSchema();
      PackageMetaData pkgMetaData = schema.getPackageMetaData();
      if(pkgMetaData == null)
      {
         clsName =
            Util.xmlNameToClassName(typeBase.getNamespaceURI(),
               typeBase.getLocalPart(),
               schema.isIgnoreLowLine()
            );
      }
      else
      {
         String pkg = pkgMetaData.getName();
         clsName =
            pkg == null || pkg.length() == 0 ?
            Util.xmlNameToClassName(typeBase.getLocalPart(), schema.isIgnoreLowLine()) :
            pkg + "." + Util.xmlNameToClassName(typeBase.getLocalPart(), schema.isIgnoreLowLine());
      }
      return clsName;
   }
View Full Code Here


   public void testLoginConfig() throws Exception
   {
      InputStream xsdIs = openStream("xml/loginconfig/user-roles_1_0.xsd");
      InputStream xmlIs = openStream("xml/loginconfig/user-roles.xml");
      SchemaBinding schema = XsdBinder.bind(xsdIs, null);
      schema.setStrictSchema(true);
      schema.setIgnoreUnresolvedFieldOrClass(false);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Users users = (Users) unmarshaller.unmarshal(xmlIs, schema);
      assertNotNull(users);
      assertEquals(6, users.size());
   }
View Full Code Here

      super(name);
   }

   public void testNested() throws Exception
   {
      SchemaBinding schema = JBossXBBuilder.build(Root.class);
      schema.setSchemaResolver(new MultiClassSchemaResolver());
      String name = findTestXml();
      Object o = unmarshal(name, schema);
      assertNotNull(o);
      assertTrue(o instanceof Root);
      Root root = (Root) o;
View Full Code Here

      assertEquals(expected, result);
   }

   public void testSimpleBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(root);
      assertNotNull(schemaBinding);

      QName qName = SimpleTypeBindings.typeQName(root);
      assertNotNull(qName);
      TypeBinding expectedTypeBinding = schemaBinding.getType(qName);
     
      QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true));
      ElementBinding elementBinding = schemaBinding.getElement(elementName);
      assertNotNull(elementBinding);
      assertTrue(expectedTypeBinding == elementBinding.getType());
   }
View Full Code Here

      assertEquals("test-element-2", wildcard[1].getNodeName());
   }

   public void testWildcardBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(ArrayElementWildcard.class);
      assertNotNull(schemaBinding);
     
      QName qName = new QName(XMLConstants.NULL_NS_URI, "array-element-wildcard");
      ElementBinding element = schemaBinding.getElement(qName);
      assertNotNull(element);
      TypeBinding type = element.getType();
      assertNotNull(type);
      ParticleBinding particle = type.getParticle();
      assertNotNull(particle);
View Full Code Here

      assertEquals("Hello", actual);
   }

   public void testValueBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(SpecifiedValue.class);
      assertNotNull(schemaBinding);
     
      // TODO check the model
   }
View Full Code Here

      assertEquals(expected, actual);
   }

   public void testValueBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(root);
      assertNotNull(schemaBinding);
     
      ElementBinding element = schemaBinding.getElement(new QName(valueElement));
      assertNotNull(element);
      assertNotNull(element.getType().getSimpleType());
   }
View Full Code Here

      assertEquals("test-element-2", wildcard.get(1).getNodeName());
   }

   public void testWildcardBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(ListElementWildcard.class);
      assertNotNull(schemaBinding);
     
      QName qName = new QName(XMLConstants.NULL_NS_URI, "list-element-wildcard");
      ElementBinding element = schemaBinding.getElement(qName);
      assertNotNull(element);
      TypeBinding type = element.getType();
      assertNotNull(type);
      ParticleBinding particle = type.getParticle();
      assertNotNull(particle);
View Full Code Here

      assertEquals("e3-child", element.getNodeName());
   }

   public void testWildcardBinding() throws Exception
   {
      SchemaBinding schemaBinding = JBossXBBuilder.build(ElementPropertiesAndWildcard.class);
      assertNotNull(schemaBinding);
     
      QName qName = new QName(XMLConstants.NULL_NS_URI, "element-properties-and-wildcard");
      ElementBinding element = schemaBinding.getElement(qName);
      assertNotNull(element);
      TypeBinding type = element.getType();
      assertNotNull(type);
      ParticleBinding particle = type.getParticle();
      assertNotNull(particle);
View Full Code Here

      super(name);
   }

   public void testBinding() throws Exception
   {
      SchemaBinding schema = JBossXBBuilder.build(RootWithTwoPropertyGroups.class);
      ElementBinding e = schema.getElement(new QName("main-root"));
      assertNotNull(e);
      TermBinding t = e.getType().getParticle().getTerm();
      assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding);
      Collection<ParticleBinding> particles = ((ModelGroupBinding)t).getParticles();
      assertEquals(2, particles.size());
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding

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.