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

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


      schema.setIgnoreUnresolvedFieldOrClass(false);
      schema.setIgnoreWhitespacesInMixedContent(false);

      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(Top.class.getName());
      ElementBinding element = schema.getElement(new QName(NS, "top"));
      assertNotNull(element);
      element.setClassMetaData(classMetaData);
     
      Top top = (Top) unmarshal("IgnorableWhitespaceContent.xml", schema, Top.class);
      assertNotNull(top.string);
      assertEquals(2, top.string.size());
      assertEquals(" ", top.string.get(0));
View Full Code Here


      schema.setIgnoreUnresolvedFieldOrClass(false);
      schema.setIgnoreWhitespacesInMixedContent(false);

      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(Top.class.getName());
      ElementBinding element = schema.getElement(new QName(NS, "top"));
      assertNotNull(element);
      element.setClassMetaData(classMetaData);
     
      Top top = new Top();
      top.string = new ArrayList();
      top.string.add(" ");
      top.string.add("\n      newline, 6 spaces, newline, 3 spaces\n   ");
View Full Code Here

      SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null);

      // get bound components
      TypeBinding type = schema.getType(new QName("http://org.jboss.ws/jbws434/types", "ArrayOfAny"));
      WildcardBinding wildcard = type.getWildcard();
      ElementBinding e = schema.getElement(new QName("http://org.jboss.ws/jbws434/types", "e"));

      // adjust binding
      ParticleHandler unresolvedElementHandler;
      CharactersHandler unresolvedCharactersHandler;
      if(genericElement)
      {
         unresolvedElementHandler = new GenericElementHandler();
         unresolvedCharactersHandler = new GenericCharactersHandler();
      }
      else
      {
         unresolvedElementHandler = DomParticleHandler.INSTANCE;
         unresolvedCharactersHandler = DomCharactersHandler.INSTANCE;
      }

      wildcard.setUnresolvedElementHandler(unresolvedElementHandler);
      wildcard.setUnresolvedCharactersHandler(unresolvedCharactersHandler);
      PropertyMetaData property = new PropertyMetaData();
      property.setName("_any");
      wildcard.setPropertyMetaData(property);

      ClassMetaData clsBinding = new ClassMetaData();
      clsBinding.setImpl(ArrayOfAny.class.getName());
      e.setClassMetaData(clsBinding);

      // to fail the resolution quickly
      schema.setSchemaResolver(new SchemaBindingResolver()
      {
         public String getBaseURI()
View Full Code Here

      {
         XSElementDeclaration xsElement = (XSElementDeclaration) elements.item(i);
         if (IGNORED_NS.contains(xsElement.getNamespace()))
            continue;
         QName elementQName = new QName(xsElement.getNamespace(), xsElement.getName());
         ElementBinding elementBinding = schemaBinding.getElement(elementQName);
         assertNotNull("ElementBinding " + elementQName + " exists", elementBinding);
      }
   }
View Full Code Here

      {
         ParticleBinding particle = i.next();
         TermBinding term = particle.getTerm();
         if(term.isElement())
         {
            ElementBinding element = (ElementBinding) term;
            elementParticles.put(element.getQName(), particle);
         }
         else if(term.isWildcard())
            elementParticles.put(WILDCARD, particle);
         else
         {
View Full Code Here

      classMetaData.setImpl(Container.class.getName());

      PropertyMetaData property = new PropertyMetaData();
      property.setName("value");
     
      ElementBinding containerStrict = schema.getElement(containerStrictQName);
      containerStrict.setClassMetaData(classMetaData);
      containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler);
      ElementBinding containerLax = schema.getElement(containerLaxQName);
      containerLax.setClassMetaData(classMetaData);
      containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler);
      ElementBinding containerSkip = schema.getElement(containerSkipQName);
      containerSkip.setClassMetaData(classMetaData);
      containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler);

      return schema;
   }
View Full Code Here

   private static final QName testQName = new QName(NS, "test");

   public SchemaBinding init(SchemaBinding schema)
   {
      ElementBinding test = schema.getElement(testQName);
      ClassMetaData classMetaData = new ClassMetaData();
      classMetaData.setImpl(Simple.class.getName());
      test.setClassMetaData(classMetaData);

      PropertyMetaData propMetaData = new PropertyMetaData();
      propMetaData.setName("value");
      test.setPropertyMetaData(propMetaData);
     
      return schema;
   }
View Full Code Here

      return builder.toString();
   }

   public static void printElement(StringBuilder builder, int pad, ParticleBinding particle)
   {
      ElementBinding element = (ElementBinding) particle.getTerm();
      pad(builder, pad);
      builder.append("<element name=\"").append(element.getQName()).append("\"");
      int minOccurs = particle.getMinOccurs();
      if (minOccurs != 1)
         builder.append(" minOccurs=\"").append(minOccurs).append("\"");
      int maxOccurs = particle.getMaxOccurs();
      if (maxOccurs != 1)
      {
         builder.append(" maxOccurs=\"");
         if (maxOccurs == -1)
            builder.append("unbounded");
         else
            builder.append(maxOccurs);
         builder.append("\"");
      }
      TypeBinding type = element.getType();
      if (type != null && type.getQName() != null)
         builder.append(" type=\"").append(type.getQName()).append("\"");
      builder.append(">");
      if (type != null && type.getQName() == null)
         printAnonymousType(builder, pad + 3, type);
View Full Code Here

         // but should not be set as a property. Instead, items are added to it using the addMethod
         if(classMetaData == null && type.isArrayWrapper() && element.getAddMethodMetaData() == null)
         {
            if(parent == null)
            {
               ElementBinding item = type.getArrayItem();
               TypeBinding itemType = item.getType();

               Class itemCls;
               QName itemTypeQName = itemType.getQName();
               if(itemTypeQName != null && Constants.NS_XML_SCHEMA.equals(itemTypeQName.getNamespaceURI()))
               {
View Full Code Here

      return builder.toString();
   }

   public static void printElement(StringBuilder builder, int pad, ParticleBinding particle)
   {
      ElementBinding element = (ElementBinding) particle.getTerm();
      pad(builder, pad);
      builder.append("<element name=\"").append(element.getQName()).append("\"");
      int minOccurs = particle.getMinOccurs();
      if (minOccurs != 1)
         builder.append(" minOccurs=\"").append(minOccurs).append("\"");
      int maxOccurs = particle.getMaxOccurs();
      if (maxOccurs != 1)
      {
         builder.append(" maxOccurs=\"");
         if (maxOccurs == -1)
            builder.append("unbounded");
         else
            builder.append(maxOccurs);
         builder.append("\"");
      }
      TypeBinding type = element.getType();
      if (type != null && type.getQName() != null)
         builder.append(" type=\"").append(type.getQName()).append("\"");
      builder.append(">");
      if (type != null && type.getQName() == null)
         printAnonymousType(builder, pad + 3, type);
View Full Code Here

TOP

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

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.