Package org.xml.sax

Examples of org.xml.sax.ContentHandler.startDocument()


        String uri = "http://www.jcp.org/jcr/sv/1.0";
        String prefix = "sv:";

        ContentHandler ch = parent.getSession().getImportContentHandler(parent.getPath(), ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
        try {
            ch.startDocument();

            String nN = "node";
            AttributesImpl attrs = new AttributesImpl();
            attrs.addAttribute(uri, "name", prefix + "name", "CDATA", nodeName);
            ch.startElement(uri, nN, prefix + nN, attrs);
View Full Code Here


                        && foNode instanceof ObjectBuiltListener) {
                    ((ObjectSource) subHandler).setObjectBuiltListener(
                            (ObjectBuiltListener) foNode);
                }

                subHandler.startDocument();
                subHandler.startElement(namespaceURI, localName,
                        rawName, attlist);
                depth = 1;
                delegate = subHandler;
            }
View Full Code Here

        String svuri = Name.NS_SV_URI;
        String svprefix = Name.NS_SV_PREFIX + ":";

        ContentHandler ch = superuser.getImportContentHandler(testRootNode.getPath(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
        ch.startDocument();
        ch.startPrefixMapping(prefix, uri);

        String nN = "node";
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", nodeName1);
View Full Code Here

    public void testSerializingContentHandler() throws Exception {
        StringWriter writer = new StringWriter();

        ContentHandler handler =
            SerializingContentHandler.getSerializer(writer);
        handler.startDocument();
        handler.startPrefixMapping("p", "uri");
        handler.startElement("uri", "a", "p:a", new AttributesImpl());
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("uri", "foo", "p:foo", "CDATA", "bar");
        handler.startElement(null, "b", "b", attributes);
View Full Code Here

    public void testNoPrefixMappingCalls() throws Exception {
        StringWriter writer = new StringWriter();

        ContentHandler handler =
            SerializingContentHandler.getSerializer(writer);
        handler.startDocument();
        handler.startElement("uri", "a", "p:a", new AttributesImpl());
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("uri", "foo", "p:foo", "CDATA", "bar");
        handler.startElement(null, "b", "b", attributes);
        handler.characters("abc".toCharArray(), 0, 3);
View Full Code Here

public class XmlnsContentHandlerTest extends TestCase {

    public void testXmlns() throws SAXException {
        ContentHandler handler =
            new XmlnsContentHandler(new ToXmlContentHandler());
        handler.startDocument();
        handler.startPrefixMapping("foo", "http://x.y.z/");
        handler.startPrefixMapping("bar", "http://a.b.c/");
        handler.startElement("", "test", "test", new AttributesImpl());
        handler.startPrefixMapping("foo", "http://a.b.c/");
        handler.startElement("", "tset", "tset", new AttributesImpl());
View Full Code Here

                 
                try{
                  NodeValue content = ModuleUtils.streamToXML(context, new ByteArrayInputStream(baos.toByteArray()));
                  resource = target.createResource(name, "XMLResource");
                  ContentHandler handler = ((XMLResource)resource).setContentAsSAX();
                  handler.startDocument();
                  content.toSAX(context.getBroker(), handler, null);
                  handler.endDocument();
                } catch(SAXException e){
                  resource = target.createResource(name, "BinaryResource");
                  resource.setContent(baos.toByteArray());
View Full Code Here

public class ToXmlContentHandlerTest extends TestCase {

    public void testMinimalDocument() throws SAXException {
        ContentHandler handler = new ToXmlContentHandler();
        handler.startDocument();
        handler.startElement("", "test", "test", new AttributesImpl());
        handler.endElement("", "test", "test");
        handler.endDocument();
        assertEquals("<?xml version=\"1.0\"?><test/>", handler.toString());
    }
View Full Code Here

        assertEquals("<?xml version=\"1.0\"?><test/>", handler.toString());
    }

    public void testAttribute() throws SAXException {
        ContentHandler handler = new ToXmlContentHandler();
        handler.startDocument();
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute("", "foo", "foo", "CDATA", "bar");
        handler.startElement("", "test", "test", attributes);
        handler.endElement("", "test", "test");
        handler.endDocument();
View Full Code Here

    public void testAttributeOrder() throws SAXException {
        ContentHandler handler;
        AttributesImpl attributes;

        handler = new ToXmlContentHandler();
        handler.startDocument();
        attributes = new AttributesImpl();
        attributes.addAttribute("", "foo", "foo", "CDATA", "A");
        attributes.addAttribute("", "bar", "bar", "CDATA", "B");
        handler.startElement("", "test", "test", attributes);
        handler.endElement("", "test", "test");
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.