Package javax.xml.bind

Examples of javax.xml.bind.Marshaller.marshal()


        Marshaller marshaller = ctx.createMarshaller();
        marshaller.setProperty("jaxb.formatted.output", true);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(object, baos);

        String actual = new String(baos.toByteArray());

        assertEquals(expected, actual);
    }
View Full Code Here


        Marshaller marshaller = entityMappingsContext.createMarshaller();
        marshaller.setProperty("jaxb.formatted.output", true);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(entityMappings, baos);

        String actual = new String(baos.toByteArray());
        return actual.trim();
    }
View Full Code Here

            Element rootElement = doc.createElement("root-element");
            JAXBElement<UsernameTokenType> tokenType =
                new JAXBElement<UsernameTokenType>(
                    QNameConstants.USERNAME_TOKEN, UsernameTokenType.class, usernameTokenType
                );
            marshaller.marshal(tokenType, rootElement);
            usernameTokenElement = (Element)rootElement.getFirstChild();
        } catch (JAXBException ex) {
            LOG.log(Level.WARNING, "", ex);
            return response;
        }
View Full Code Here

                    Iterator<String> ret = CastUtils.cast(wsdl.getNamespaces().keySet().iterator());
                    return ret;
                }
            });
           
            u.marshal(mObj, writer);
            writer.flush();           
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "",
                                    ex);
View Full Code Here

            }
            Marshaller ms = createMarshaller(actualObject, actualClass, genericType, m);

            XMLOutputFactory factory = new MappedXMLOutputFactory(namespaceMap);
            XMLStreamWriter xsw = factory.createXMLStreamWriter(os);           
            ms.marshal(actualObject, xsw);
            xsw.close();
           
        } catch (JAXBException e) {
            throw new WebApplicationException(e);
        } catch (XMLStreamException e) {
View Full Code Here

            }
            Marshaller ms = createMarshaller(actualObject, actualClass, genericType, m);
            for (Map.Entry<String, Object> entry : mProperties.entrySet()) {
                ms.setProperty(entry.getKey(), entry.getValue());
            }
            ms.marshal(actualObject, os);
           
        } catch (JAXBException e) {
            throw new WebApplicationException(e);
        }
    }
View Full Code Here

   */
  private Element marshallerPart(JIDContext context, OutputStream output, Element element) throws Exception {
    Marshaller marshaller = this.generateMarshaller(false, true);
    if (this.log.isInfoEnabled()) {
      StringBufferWriter buffer = new StringBufferWriter(new StringWriter());
      marshaller.marshal(element, buffer);
      buffer.flush();
      String content = buffer.toString();
      this.log.info("Write on " + context.jid().asString() + " " + content);
      output.write(content.getBytes("UTF-8"));
    } else {
View Full Code Here

      buffer.flush();
      String content = buffer.toString();
      this.log.info("Write on " + context.jid().asString() + " " + content);
      output.write(content.getBytes("UTF-8"));
    } else {
      marshaller.marshal(element, output);
    }
    return element;
  }

  /**
 
View Full Code Here

            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

            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

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.