Package javax.xml.transform.sax

Examples of javax.xml.transform.sax.TransformerHandler.characters()


                    String tagName = property.getKey();
                    String tagValue = (String) value;
                    AttributesImpl attributes = new AttributesImpl();
                    attributes.addAttribute("", ATT_PROPERTY_NAME, ATT_PROPERTY_NAME, null, tagName);
                    handler.startElement("", TAG_PROPERTY, TAG_PROPERTY, attributes);
                    handler.characters(tagValue.toCharArray(), 0, tagValue.length());
                    handler.endElement("", TAG_PROPERTY, TAG_PROPERTY);
                } else {
                    // TODO multi-valued properties, other primitives
                    System.err.println("Can't yet handle property " + property.getKey() + " of type "
                            + value.getClass());
View Full Code Here


          new AttributesImpl());

      response.startElement("", "msg", "msg", new AttributesImpl());
      String msg = (e.getMessage() == null ? "unknown error" : e
          .getMessage());
      response.characters(msg.toCharArray(), 0, msg.length());
      response.endElement("", "msg", "msg");

      response.startElement("", "stacktrace", "stacktrace",
          new AttributesImpl());
      StringWriter sw = new StringWriter();
View Full Code Here

      PrintWriter pw = new PrintWriter(sw, true);
      e.printStackTrace(pw);
      pw.flush();
      sw.flush();
      String trace = sw.toString();
      response.characters(trace.toCharArray(), 0, trace.length());
      response.endElement("", "stacktrace", "stacktrace");

      response.endElement("", "exception", "exception");
      response.endDocument();
View Full Code Here

                for (int i = 0; i < 100; i++) {
                    sb.append(" ");
                }
                char[] padding = sb.toString().toCharArray();
                for (int i = 0; i < 40; i++) {
                    handler.characters(padding, 0, padding.length);
                }
                handler.characters(new char[] {'\n'}, 0, 1);
                handler.processingInstruction("xpacket", "end=\"w\"");
            }
View Full Code Here

                }
                char[] padding = sb.toString().toCharArray();
                for (int i = 0; i < 40; i++) {
                    handler.characters(padding, 0, padding.length);
                }
                handler.characters(new char[] {'\n'}, 0, 1);
                handler.processingInstruction("xpacket", "end=\"w\"");
            }

        }
        handler.endDocument();
View Full Code Here

            }

            @Override
            public void writeText(final String text) throws XmlWriteException {
                try {
                    transformerHandler.characters(text.toCharArray(), 0, text.length());
                } catch (SAXException e) {
                    throw new XmlWriteException("Failed writing text [" + text + "] to XML", e);
                }
            }
View Full Code Here

            @Override
            public void writeCdata(final String cdata) throws XmlWriteException {
                try {
                    transformerHandler.startCDATA();
                    transformerHandler.characters(cdata.toCharArray(), 0, cdata.length());
                } catch (final SAXException e) {
                    throw new XmlWriteException("Failed writing CDATA section [" + cdata + "] to XML", e);
                }
            }
View Full Code Here

        t.setResult(new StreamResult(System.out));

        // Write events to the serializer
        t.startDocument();
        t.startElement("", "out", "out", new AttributesImpl());
        t.characters(new char[]{'a','&','b'}, 0, 3);
        t.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'<','M','/', '>'}, 0, 4);
        t.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'y','&','z'}, 0, 3);
        t.endElement("", "out", "out");
View Full Code Here

        // Write events to the serializer
        t.startDocument();
        t.startElement("", "out", "out", new AttributesImpl());
        t.characters(new char[]{'a','&','b'}, 0, 3);
        t.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'<','M','/', '>'}, 0, 4);
        t.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'y','&','z'}, 0, 3);
        t.endElement("", "out", "out");
        t.endDocument();
    }
View Full Code Here

        t.startElement("", "out", "out", new AttributesImpl());
        t.characters(new char[]{'a','&','b'}, 0, 3);
        t.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'<','M','/', '>'}, 0, 4);
        t.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");
        t.characters(new char[]{'y','&','z'}, 0, 3);
        t.endElement("", "out", "out");
        t.endDocument();
    }

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.