Package org.apache.ws.jaxme.impl

Examples of org.apache.ws.jaxme.impl.JMMarshallerImpl


    assertStringEquals(getAllSimpleTypesElementString(), sw.toString());
  }

  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString();
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertStringEquals(input.toString(), sw.toString());
  }
View Full Code Here


  /** <p>Tests marshalling of a complex element.</p>
   */
  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString(false, true);
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertEquals(input.toString(), sw.toString());
  }
View Full Code Here

  }

  /** <p>Tests marshalling of a simple element.</p>
   */
  public void testMarshalSimpleElements() throws Exception {
    JMMarshallerImpl m = (JMMarshallerImpl) getFactory().createMarshaller();
    StringWriter sw = new StringWriter();
    AllTypesElement element = getAllTypesElement();
    m.setXmlDeclaration(false);
    m.setEncoding("US-ASCII");
    m.marshal(element, sw);
    String expected = getAllTypesElementString(false, true);
    assertEquals(expected, sw.toString());
  }
View Full Code Here

  /** <p>Tests marshalling of a complex element.</p>
   */
  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    marshaller.setXmlDeclaration(false);
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString(false, true);
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertEquals(input.toString(), sw.toString());
  }
View Full Code Here

  }

  /** <p>Tests marshalling of a simple element.</p>
   */
  public void testMarshalSimpleElements() throws Exception {
    JMMarshallerImpl m = (JMMarshallerImpl) getFactory().createMarshaller();
    StringWriter sw = new StringWriter();
    AllTypesElement element = getAllTypesElement();
    m.setXmlDeclaration(false);
    m.setEncoding("US-ASCII");
    m.marshal(element, sw);
    String expected = getAllTypesElementString(false, true);
    assertEquals(expected, sw.toString());
  }
View Full Code Here

  /** <p>Tests marshalling of a complex element.</p>
   */
  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    marshaller.setXmlDeclaration(false);
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString(false, true);
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertEquals(input.toString(), sw.toString());
  }
View Full Code Here

  }

  /** <p>Tests marshalling of a simple element.</p>
   */
  public void testMarshalSimpleElements() throws Exception {
    JMMarshallerImpl m = (JMMarshallerImpl) getFactory().createMarshaller();
    StringWriter sw = new StringWriter();
    AllTypesElement element = getAllTypesElement();
    m.setXmlDeclaration(false);
    m.setEncoding("US-ASCII");
    m.marshal(element, sw);
    String expected = getAllTypesElementString(false, true);
    assertEquals(expected, sw.toString());
  }
View Full Code Here

  /** <p>Tests marshalling of a complex element.</p>
   */
  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    marshaller.setXmlDeclaration(false);
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString(false, true);
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertEquals(input.toString(), sw.toString());
  }
View Full Code Here

    assertStringEquals(getAllSimpleTypesElementString(), sw.toString());
  }

  public void testMarshalComplexElements() throws Exception {
    JAXBContext myFactory = getFactory();
    JMMarshallerImpl marshaller = (JMMarshallerImpl) myFactory.createMarshaller();
    StringWriter sw = new StringWriter();
    Class c = marshaller.getXMLWriterClass();
    XMLWriter w = (XMLWriter) c.newInstance();
    w.init(marshaller);
    String rawInput = getAllTypesElementString();
    StringBuffer input = new StringBuffer();
    for (int i = 0;  i < rawInput.length();  i++) {
      char ch = rawInput.charAt(i);
      boolean done = false;
      if (ch == '&') {
        if (i+1 < rawInput.length()  &&  rawInput.charAt(i+1) == '#') {
          int j = 2;
          StringBuffer digits = new StringBuffer();
          while (i+j < rawInput.length()  &&  Character.isDigit(rawInput.charAt(i+j))) {
            digits.append(rawInput.charAt(i+j));
            ++j;
          }
          if (digits.length() > &&
              i+j < rawInput.length()  &&  rawInput.charAt(i+j) == ';') {
            char chr = (char) Integer.parseInt(digits.toString());
            if (w.canEncode(chr)) {
              done = true;
              i += j;
              input.append(chr);
            }
          }
        }
      }
      if (!done) {
        input.append(ch);
      }
    }
    marshaller.marshal(getAllTypesElement(), sw);
    assertStringEquals(input.toString(), sw.toString());
  }
View Full Code Here

  }

  /** <p>Tests marshalling of a simple element.</p>
   */
  public void testMarshalSimpleElements() throws Exception {
    JMMarshallerImpl m = (JMMarshallerImpl) getFactory().createMarshaller();
    StringWriter sw = new StringWriter();
    AllTypesElement element = getAllTypesElement();
    m.setXmlDeclaration(false);
    m.setEncoding("US-ASCII");
    m.marshal(element, sw);
    String expected = getAllTypesElementString(false, true);
    assertEquals(expected, sw.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.impl.JMMarshallerImpl

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.