Package org.xml.sax

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


            attrs.addAttribute(uri, "name", prefix + "name", "CDATA", JcrConstants.JCR_PRIMARYTYPE);
            attrs.addAttribute(uri, "type", prefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.NAME));
            ch.startElement(uri, pN, prefix + pN, attrs);
            ch.startElement(uri, "value", prefix + "value", new AttributesImpl());
            char[] val = ntName.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(uri, "value", prefix + "value");
            ch.endElement(uri, pN, prefix + pN);

            // uuid
            attrs = new AttributesImpl();
View Full Code Here


            attrs.addAttribute(uri, "name", prefix + "name", "CDATA", JcrConstants.JCR_UUID);
            attrs.addAttribute(uri, "type", prefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.STRING));
            ch.startElement(uri, pN, prefix + pN, attrs);
            ch.startElement(uri, "value", prefix + "value", new AttributesImpl());
            val = uuid.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(uri, "value", prefix + "value");
            ch.endElement(uri, pN, prefix + pN);

            ch.endElement(uri, nN, prefix + nN);
            ch.endDocument();
View Full Code Here

        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", JcrConstants.JCR_PRIMARYTYPE);
        attrs.addAttribute(svuri, "type", svprefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.NAME));
        ch.startElement(svuri, pN, svprefix + pN, attrs);
            ch.startElement(svuri, "value", svprefix + "value", new AttributesImpl());
            char[] val = testNodeType.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(svuri, "value", svprefix + "value");
        ch.endElement(svuri, pN, prefix + pN);

        // another name value
        attrs = new AttributesImpl();
View Full Code Here

        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", propertyName1);
        attrs.addAttribute(svuri, "type", svprefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.NAME));
        ch.startElement(svuri, pN, svprefix + pN, attrs);
            ch.startElement(svuri, "value", svprefix + "value", new AttributesImpl());
            val = testValue.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(svuri, "value", svprefix + "value");
        ch.endElement(svuri, pN, svprefix + pN);

        ch.endElement(svuri, nN, svprefix + nN);
        ch.endDocument();
View Full Code Here

        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);
        handler.characters("abc".toCharArray(), 0, 3);
        handler.endElement(null, "b", "b");
        handler.startElement(null, "c", "c", new AttributesImpl());
        handler.endElement(null, "c", "c");
        handler.characters("xyz".toCharArray(), 0, 3);
        handler.endElement("uri", "a", "p:a");
View Full Code Here

        handler.startElement(null, "b", "b", attributes);
        handler.characters("abc".toCharArray(), 0, 3);
        handler.endElement(null, "b", "b");
        handler.startElement(null, "c", "c", new AttributesImpl());
        handler.endElement(null, "c", "c");
        handler.characters("xyz".toCharArray(), 0, 3);
        handler.endElement("uri", "a", "p:a");
        handler.endPrefixMapping("p");
        handler.endDocument();

        String xml = writer.toString();
View Full Code Here

        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);
        handler.endElement(null, "b", "b");
        handler.startElement(null, "c", "c", new AttributesImpl());
        handler.endElement(null, "c", "c");
        handler.characters("xyz".toCharArray(), 0, 3);
        handler.endElement("uri", "a", "p:a");
View Full Code Here

        handler.startElement(null, "b", "b", attributes);
        handler.characters("abc".toCharArray(), 0, 3);
        handler.endElement(null, "b", "b");
        handler.startElement(null, "c", "c", new AttributesImpl());
        handler.endElement(null, "c", "c");
        handler.characters("xyz".toCharArray(), 0, 3);
        handler.endElement("uri", "a", "p:a");
        handler.endDocument();

        String xml = writer.toString();
        assertContains(xml, "<p:a");
View Full Code Here

    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(
                "<?xml version=\"1.0\"?><test>foo</test>",
                handler.toString());
View Full Code Here

        attributes.addAttribute(
                "http://www.w3.org/2000/xmlns/", "xmlns", "xmlns:abc",
                "CDATA", "http://a.b.c/");
        handler.startElement("", "test", "test", attributes);
        handler.ignorableWhitespace("\n  ".toCharArray(), 0, 3);
        handler.characters("abc\n".toCharArray(), 0, 4);
        handler.characters("  ".toCharArray(), 0, 2);
        attributes = new AttributesImpl();
        attributes.addAttribute("", "escape", "escape", "CDATA", "\"'<>&");
        handler.startElement("http://a.b.c/", "foo", "abc:foo", attributes);
        handler.characters("def".toCharArray(), 0, 3);
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.