Package javax.xml.bind

Examples of javax.xml.bind.Marshaller


            xrd.getService().add(service);

            xrds.getOtherelement().add(xrd);

            Marshaller marshaller = jaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.marshal(xrds, writer);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


            EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
            entityDescriptor.setEntityID(getEntityId());
            entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(spSsoDescriptor);

            Marshaller marshaller = metaDataJaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
            entityDescriptor.setEntityID(getEntityId());
            entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpSsoDescriptor);

            Marshaller marshaller = metaDataJaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

      extendedMetadataIsBuilt = true;
    }

    try {
      final JAXBContext context = JAXBContext.newInstance(AbstractSqlResourceMetaData.class);
      final Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
      final StringWriter writer = new StringWriter();
      marshaller.marshal(this, writer);
      return writer.toString();
    } catch (final JAXBException exception) {
      return exception.toString();
    }
  }
View Full Code Here

  /**
   * Marshall a JAXB object and return the XML as a string
   */
  public static String marshallJAXBObject(String namespace, Object o, boolean addXMLDeclaration) throws JAXBException {
    JAXBContext jc = getJAXBContext(namespace);
    Marshaller marshaller = jc.createMarshaller();
    marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", addXMLDeclaration);
    StringWriter sw = new StringWriter();
    marshaller.marshal(o, sw);
    return sw.toString();
  }
View Full Code Here

    JaxbHelper jaxbHelper = JaxbHelper.get(item.getClass());

    StringWriter writer = new StringWriter();
    try {
      Marshaller marshaller = jaxbHelper.createMarshaller();

      // OpsSecretEncryptionStrategy strategy = new OpsSecretEncryptionStrategy(itemSecret);
      // strategy.setAdapter(marshaller);

      marshaller.marshal(mutableItem, writer);
    } catch (JAXBException e) {
      throw new IllegalArgumentException("Could not serialize data", e);
    }
    String xml = writer.toString();
View Full Code Here

    JAXBContext jaxbContext = jaxbContextHelper.getJaxbContext(clazz);

    // TODO: Is this expensive? Pool marshallers?

    try {
      Marshaller m = jaxbContext.createMarshaller();
      // m.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
      m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
      return m;
    } catch (JAXBException e) {
      throw new IllegalStateException("Error creating XML marshaller", e);
    }
  }
View Full Code Here

        cmd.getCommands().add( new InsertObjectCommand( baunax,
                                                        "baunax" ) );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
        marshaller.marshal( cmd,
                            xmlReq );

        System.out.println( xmlReq.toString() );

        String xmlCmd = "";
View Full Code Here

                                                                    21 ),
                                                        "person3" ) );
        cmd.getCommands().add( new FireAllRulesCommand() );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
        marshaller.marshal( cmd,
                            xmlReq );

        System.out.println( xmlReq.toString() );

        byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session",
View Full Code Here

        cmd.setLookup( "ksession1" );
        cmd.getCommands().add( new GetObjectCommand( new DefaultFactHandle( handle ),
                                                     "hadrian" ) );

        StringWriter xmlReq = new StringWriter();
        Marshaller marshaller = getJaxbContext().createMarshaller();
        marshaller.setProperty( "jaxb.formatted.output",
                                true );
        marshaller.marshal( cmd,
                            xmlReq );

        System.out.println( xmlReq.toString() );

        byte[] xmlResp = (byte[]) template.requestBody( "direct:test-with-session",
View Full Code Here

TOP

Related Classes of javax.xml.bind.Marshaller

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.