Examples of Root


Examples of org.castor.xmlctf.xmldiff.xml.nodes.Root

            err.append(", column: ");
            err.append(sxp.getColumnNumber());
            throw new NestedIOException(err.toString(), sx);
        }

        Root root = (Root) node;
        return root;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.oxm.Root

     * @param elt
     * @return
     */
    private Root createXMLRootFromJAXBElement(JAXBElement elt) {
        // create an XMLRoot to hand into the marshaller
      Root xmlroot = new Root();
        Object objectValue = elt.getValue();
        xmlroot.setObject(objectValue);
        QName qname = elt.getName();
        xmlroot.setLocalName(qname.getLocalPart());
        xmlroot.setNamespaceURI(qname.getNamespaceURI());
        xmlroot.setDeclaredType(elt.getDeclaredType());
        xmlroot.setNil(elt.isNil());
        if (elt.getDeclaredType() == CoreClassConstants.ABYTE || elt.getDeclaredType() == CoreClassConstants.APBYTE ||
                elt.getDeclaredType().getCanonicalName().equals("javax.activation.DataHandler") ||
                elt.getDeclaredType().isEnum()) {
            // need a binary data mapping so need to wrap
            Class generatedClass = getClassToGeneratedClasses().get(elt.getDeclaredType().getCanonicalName());
            if(!elt.getDeclaredType().isEnum()) {
                xmlroot.setSchemaType(Constants.BASE_64_BINARY_QNAME);
            }
            if (generatedClass != null && WrappedValue.class.isAssignableFrom(generatedClass)) {
                ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
                Object newObject = desc.getInstantiationPolicy().buildNewInstance();
                ((WrappedValue) newObject).setValue(objectValue);
                xmlroot.setObject(newObject);
                return xmlroot;
            }
        } else {
            xmlroot.setSchemaType((QName) org.eclipse.persistence.internal.oxm.XMLConversionManager.getDefaultJavaTypes().get(elt.getDeclaredType()));
        }

        if (elt instanceof WrappedValue) {
            xmlroot.setObject(elt);
            return xmlroot;
        }
        Map<QName, Class> qNameToGeneratedClasses = jaxbContext.getQNameToGeneratedClasses();
        if (qNameToGeneratedClasses != null) {
            Class theClass = qNameToGeneratedClasses.get(qname);
            if (theClass != null && WrappedValue.class.isAssignableFrom(theClass)) {
                ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(theClass).getDescriptor(theClass);
                Object newObject = desc.getInstantiationPolicy().buildNewInstance();
                ((WrappedValue) newObject).setValue(objectValue);
                xmlroot.setObject(newObject);
                return xmlroot;
            }
        }

        Class generatedClass = null;
        if (jaxbContext.getTypeMappingInfoToGeneratedType() != null) {
            if (jaxbContext.getTypeToTypeMappingInfo() != null) {
                if (elt.getDeclaredType() != null && elt.getDeclaredType().isArray()) {
                    TypeMappingInfo tmi = jaxbContext.getTypeToTypeMappingInfo().get(elt.getDeclaredType());
                    generatedClass = jaxbContext.getTypeMappingInfoToGeneratedType().get(tmi);
                } else if (elt instanceof JAXBTypeElement) {
                    Type objectType = ((JAXBTypeElement) elt).getType();
                    TypeMappingInfo tmi = jaxbContext.getTypeToTypeMappingInfo().get(objectType);
                    generatedClass = jaxbContext.getTypeMappingInfoToGeneratedType().get(tmi);
                }
            }
        } else {
            if (elt.getDeclaredType() != null && elt.getDeclaredType().isArray()) {
                if (jaxbContext.getArrayClassesToGeneratedClasses() != null) {
                    generatedClass = jaxbContext.getArrayClassesToGeneratedClasses().get(elt.getDeclaredType().getCanonicalName());
                }
            } else if (elt instanceof JAXBTypeElement) {
                Type objectType = ((JAXBTypeElement) elt).getType();
                generatedClass = jaxbContext.getCollectionClassesToGeneratedClasses().get(objectType);
            }
        }

        if (generatedClass != null) {
            ClassDescriptor desc = xmlMarshaller.getXMLContext().getSession(generatedClass).getDescriptor(generatedClass);
            Object newObject = desc.getInstantiationPolicy().buildNewInstance();
            ((ManyValue) newObject).setItem(objectValue);
            xmlroot.setObject(newObject);
        }

        return xmlroot;
    }
View Full Code Here

Examples of org.foray.fotree.fo.obj.Root

     * @throws FOrayException For errors building the FO Tree.
     */
    public AreaTree buildAreaTree(final String file) throws FOrayException {
        final FoDocumentReader foReader = FoDocumentReader.getInstance();
        final FOTreeBuilder foTree = foReader.buildFoTree(file);
        final Root root = foTree.getRootFo();
        final AreaTree areaTree = this.areaTreeFactory.makeAreaTree(root);
        final PioneerLS layout = this.layoutFactory.makeLayout();
        final Iterator<PageSequence> iterator = root.getPageSequenceIterator();
        while (iterator.hasNext()) {
            final PageSequence pageSequence = iterator.next();
            try {
                final PageCollection collection = areaTree.makePageCollection(
                        pageSequence);
View Full Code Here

Examples of org.jboss.test.xb.builder.object.element.javatypeadapter.support.Root

   }

   @SuppressWarnings("unchecked")
   public void testMap() throws Exception
   {
      Root root = unmarshalObject(Root.class);
      Map<Integer, String> map = root.getMap();
      assertNotNull(map);
      assertEquals(3, map.size());
      assertEquals("value1", map.get(1));
      assertEquals("value22", map.get(22));
      assertEquals("value333", map.get(333));
View Full Code Here

Examples of org.jboss.test.xb.builder.object.element.xmlelement.support.nondefaults.Root

      super(name);
   }

   public void testNonDefaultsUnmarshal() throws Exception
   {
      Root root = unmarshalObject(Root.class);
      String result = root.getElement();
      assertEquals("Hello", result);
   }
View Full Code Here

Examples of org.jboss.test.xb.builder.object.jbossxmlcollection.support.Root

      super(name);
   }

   public void testDefault() throws Exception
   {
      Root root = unmarshalObject(Root.class);
      assertNotNull(root);
      assertNull(root.getUnparameterizedList());
      assertNull(root.getJbossXmlList());
      List<?> list = root.getDefaultList();
      assertNotNull(list);
      assertEquals(3, list.size());
      assertEquals("default1", list.get(0));
      assertEquals("default22", list.get(1));
      assertEquals("default333", list.get(2));
View Full Code Here

Examples of org.jboss.test.xb.builder.object.jbossxmlmapentry.support.Root

      super(name);
   }

   public void testKeyValueSequence() throws Exception
   {
      Root root = unmarshalObject(Root.class);
      assertMap(root.getKeyValueSequence());
   }
View Full Code Here

Examples of org.jboss.test.xb.builder.object.propertyrefs.support.Root

     
      System.setProperty(minName, "1");
      System.setProperty(maxName, "3");
      System.setProperty(valName, "2");

      Root root = unmarshalObject(Root.class);
      assertEquals(1, root.getMin());
      assertEquals(3, root.getMax());
      assertEquals(2, root.getValue());
   }
View Full Code Here

Examples of org.jboss.test.xml.choice.Root

   {
      log.debug("testChoice> started");
      long startTime = System.currentTimeMillis();

      String xsdUrl = getXsd("xml/choice.xsd");
      Root root = newChoiceRoot();
      String xml = marshalChoiceRoot(xsdUrl, root);

      StringReader reader = new StringReader(xml);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Root unmarshalled = (Root)unmarshaller.unmarshal(reader, new MappingObjectModelFactory(), null);
      log.info("unmarhalled:\n" + unmarshalled);

      assertEquals(root, unmarshalled);

      log.debug("testChoice> done in " + (System.currentTimeMillis() - startTime));
View Full Code Here

Examples of org.jboss.test.xml.jbxb.schemabindingattribute.Root

      schema.setSchemaResolver(new MultiClassSchemaResolver());
      String name = findTestXml();
      Object o = unmarshal(name, schema);
      assertNotNull(o);
      assertTrue(o instanceof Root);
      Root root = (Root) o;
      assertNotNull(root.getAnyElement());
      assertEquals(1, root.getAnyElement().length);
      o = root.getAnyElement()[0];
      assertNotNull(o);
      assertTrue(o instanceof Ns2Root);
   }
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.