The SAX parser will invoke this method only once, before any other event callbacks (except for {@link #setDocumentLocator setDocumentLocator}).
6162636465666768697071
assertEquals( "<?xml version=\"1.0\"?><test foo=\"A\" bar=\"B\"/>", handler.toString()); handler = new ToXmlContentHandler(); handler.startDocument(); attributes = new AttributesImpl(); attributes.addAttribute("", "bar", "bar", "CDATA", "B"); attributes.addAttribute("", "foo", "foo", "CDATA", "A"); handler.startElement("", "test", "test", attributes); handler.endElement("", "test", "test");
7576777879808182838485
handler.toString()); } public void testChildElements() throws SAXException { ContentHandler handler = new ToXmlContentHandler(); handler.startDocument(); handler.startElement("", "test", "test", new AttributesImpl()); handler.startElement("", "foo", "foo", new AttributesImpl()); handler.endElement("", "foo", "foo"); handler.startElement("", "bar", "bar", new AttributesImpl()); handler.endElement("", "bar", "bar");
90919293949596979899100
handler.toString()); } public void testCharacters() throws SAXException { ContentHandler handler = new ToXmlContentHandler(); handler.startDocument(); handler.startElement("", "test", "test", new AttributesImpl()); handler.characters("foo".toCharArray(), 0, 3); handler.endElement("", "test", "test"); handler.endDocument(); assertEquals(
102103104105106107108109110111112
handler.toString()); } public void testIgnorableWhitespace() throws SAXException { ContentHandler handler = new ToXmlContentHandler(); handler.startDocument(); handler.ignorableWhitespace("\n".toCharArray(), 0, 1); handler.startElement("", "test", "test", new AttributesImpl()); handler.ignorableWhitespace("\n".toCharArray(), 0, 1); handler.endElement("", "test", "test"); handler.ignorableWhitespace("\n".toCharArray(), 0, 1);
116117118119120121122123124125126
handler.toString()); } public void testProcessingInstruction() throws SAXException { ContentHandler handler = new ToXmlContentHandler(); handler.startDocument(); handler.processingInstruction("foo", "abc=\"xyz\""); handler.startElement("", "test", "test", new AttributesImpl()); handler.processingInstruction("bar", null); handler.endElement("", "test", "test"); handler.endDocument();
130131132133134135136137138139140
handler.toString()); } public void testComplexDocument() throws SAXException { ContentHandler handler = new ToXmlContentHandler(); handler.startDocument(); handler.ignorableWhitespace("\n".toCharArray(), 0, 1); handler.processingInstruction("foo", "abc=\"xyz\""); handler.ignorableWhitespace("\n".toCharArray(), 0, 1); AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "version", "version", "CDATA", "1.0");
339340341342343344345346347348349
&& foNode instanceof ObjectBuiltListener) { ((ObjectSource) subHandler).setObjectBuiltListener( (ObjectBuiltListener) foNode); } subHandler.startDocument(); subHandler.startElement(namespaceURI, localName, rawName, attlist); depth = 1; delegate = subHandler; }
137138139140141142143144145146147
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ContentHandler contentHandler = adapter.getContentHandler(context.getBroker(), configFile, parameters, mimeType, baos); // process the XSL-FO contentHandler.startDocument(); inputNode.toSAX(context.getBroker(), contentHandler, new Properties()); contentHandler.endDocument(); // return the result return BinaryValueFromInputStream.getInstance(context, new Base64BinaryValueType(), new ByteArrayInputStream(baos.toByteArray()));
200201202203204205206207208209210
serializer.setOutput(writer, null); item.toSAX(context.getBroker(), serializer, SERIALIZATION_PROPERTIES); resource.setContent(writer.toString()); } else { final ContentHandler handler = ((XMLResource)resource).setContentAsSAX(); handler.startDocument(); item.toSAX(context.getBroker(), handler, SERIALIZATION_PROPERTIES); handler.endDocument(); } } else {
302303304305306307308309310311312