Examples of SchemaBinding


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

   protected <T, U> T unmarshalObject(Class<T> expected, Class<U> reference, Class<?>... others) throws Exception
   {
      TestSchemaResolver resolver = new TestSchemaResolver();

      SchemaBinding schemaBinding = JBossXBBuilder.build(reference);
      resolver.addSchemaBinding(schemaBinding);
      if (others != null)
      {
         for (Class<?> other : others)
         {
            SchemaBinding otherBinding = JBossXBBuilder.build(other);
            resolver.addSchemaBinding(otherBinding);
         }
      }

      String testXml = findTestXml();
View Full Code Here

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

    * Initialise the schema
    */
   protected void initSchema()
   {
      // Initialize the schema
      schemaBinding = new SchemaBinding();
      JBossXBBuilder.initSchema(schemaBinding, root);
      if (trace)
         log.trace("Building schema for " + root.getName() + " schemaBinding=" + schemaBinding);

      // Remember the default namespace
View Full Code Here

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

    * @throws Exception for any problem
    */
   protected Object unmarshal() throws Exception
   {
      String testXsd = findXML(rootName + "_" + getName() + ".xsd");
      SchemaBinding schema = XsdBinder.bind(testXsd, (SchemaBindingResolver)null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      return unmarshaller.unmarshal(findXML(rootName + "_" + getName() + ".xml"), schema);
   }
View Full Code Here

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

      assertMultidimArray(arr);
   }

   public void testUnmarshalListType() throws Exception
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(LIST_TYPE_XML), schema);
      assertNotNull(o);
      assertTrue(o instanceof ListWrapper);
View Full Code Here

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

   {
      ListWrapper lists = new ListWrapper();
      lists.field1 = Arrays.asList(new String[]{"str1", "str2", "str3"});
      lists.field2 = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.FALSE, Boolean.TRUE});

      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      StringWriter writer = new StringWriter();
      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.marshal(schema, null, lists, writer);
View Full Code Here

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

         new QName[]{new QName("http://ns1", "name1"),
                     new QName("http://ns2", "name2"),
                     new QName("http://ns3", "name3")
         };

      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      StringWriter writer = new StringWriter();
      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.marshal(schema, null, lists, writer);
View Full Code Here

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

   // Private

   private void unmarshalQNameArray(String xml)
      throws JBossXBException
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(xml), schema);
      assertNotNull(o);
      assertTrue(o instanceof ListWrapper);
View Full Code Here

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

   private Object unmarshalMDArray(boolean annotations)
      throws JBossXBException
   {
      String xsd = getMultiDimArrayXsd(annotations);
      SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      return unmarshaller.unmarshal(new StringReader(MULTIDIM_ARR_XML), schema);
   }
View Full Code Here

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

   }

   private void unmarshalCollections(Reader xmlReader) throws JBossXBException
   {
      String xsd = getFullPath("xml/collections.xsd");
      SchemaBinding schema = XsdBinder.bind(xsd);
      schema.setIgnoreUnresolvedFieldOrClass(false);
      String ns = "http://www.jboss.org/test/xml/collections";
      QName rootQName = new QName(ns, "collections");
      TypeBinding type = schema.getType(rootQName);
      assertNotNull(type);
      schema.addElement(rootQName, type);

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Collections collections;
      collections = (Collections)unmarshaller.unmarshal(xmlReader, schema);
      assertEquals(Collections.getInstance(), collections);
View Full Code Here

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

      super(name);
   }

   public void testUnmarshallingGenericElement() throws Exception
   {
      SchemaBinding schema = getSchemaBinding(true);
     
      // unmarshal
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(XML), schema);
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.