Package org.xml.sax

Examples of org.xml.sax.XMLFilter


        String data = "<?xml version=\"1.0\"?>\n"
          + "<!DOCTYPE root [\n" +
                "  <?target data?>\n  <!ELEMENT test (#PCDATA)>" +
            "\n  <?target?>\n]>"
          + "\n<test />\n"
        XMLFilter filter = new XMLFilterImpl();
        filter.setParent(XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"));
        Document doc = (new Builder(filter)).build(data, null);
        String result = doc.toXML();
        assertEquals(data, result);   
       
   
View Full Code Here


        // Make sure we can count the actual numbers of elements etc. that
        // are created
        builder.setFactory(factory);

        // Count specific attributes and elements for some of the tests
        XMLFilter filter = new XMLFilterImpl() {
            public void startElement(String namespaceURI,
                                     String localName,
                                     String qName,
                                     Attributes attributes)
                throws SAXException {
View Full Code Here

     */
    private Object id;

    // javadoc inherited
    public XMLFilter selectScriptFilter(String contentType) {
        XMLFilter filter = null;
        ScriptFilter scriptFilter = (ScriptFilter)scriptFilters.get(contentType);
        if (scriptFilter != null) {
            Class sfClass = scriptFilter.getScriptClass();
            if (sfClass != null) {
                try {
View Full Code Here

        return (ProxyManager) proxyManagers.get(id);
    }

    // javadoc inherited
    public XMLFilter retrieveScriptFilter(String id, String contentType) {
        XMLFilter filter = null;
        ScriptModule module = (ScriptModule)scriptModules.get(id);
        if (module != null) {
            filter = module.selectScriptFilter(contentType);
        }
View Full Code Here

     */
    private void consumeResponse(String redirectURL,
                                 InputStream response,
                                 String contentType)
            throws IOException, SAXException {
        XMLFilter responseFilter = retrieveResponseFilter(contentType);
        ContentConditioner conditioner =
                createContentConditioner(contentType, responseFilter);
        InputSource source = new InputSource(response);

        String charEncoding;
View Full Code Here

     * @param contentType The content type.
     */
    private XMLFilter retrieveResponseFilter(String contentType) {
        XMLPipelineContext context = getPipelineContext();
        Script script = (Script) context.getProperty(Script.class);
        XMLFilter responseFilter = null;
        if (script != null) {
            responseFilter =
                    configuration.retrieveScriptFilter(script.getRef(),
                                                       contentType);
        } else {
View Full Code Here

        VolantisXMLReaderFactory readerFactory = new VolantisXMLReaderFactory();
        readerFactory.disableValidation();
        XMLReader reader = readerFactory.create();

        XMLFilter filter;


        filter = createFilter();
        if (filter != null) {
            filter.setParent(reader);
            reader = filter;

        }

        filter = new XMLFilterImpl() {

            public void startElement(
                    String uri, String localName, String qName, Attributes atts)
            throws SAXException {
                System.out.println("<" + qName + ">");
                super.startElement(uri, localName, qName, atts);
            }


            public void endElement(String uri, String localName, String qName)
            throws SAXException {
                System.out.println("</" + qName + ">");
                super.endElement(uri, localName, qName);
            }
        };
        filter.setParent(reader);
        reader = filter;

        reader.setContentHandler(new ValidatingHandler(validator,
                getSchemaNamespaces()));
       
View Full Code Here

    // which is not guaranteed. I use a custom SAX Filter to
    // make sure the namespace declaration comes before the attribute.
    public void testAttributesVsNamespaces()
      throws ParsingException, IOException, SAXException {
         
       XMLFilter filter = new OrderingFilter();
       filter.setParent(
         XMLReaderFactory.createXMLReader(
           "org.apache.xerces.parsers.SAXParser"
         )
       );
       Builder builder = new Builder(filter);
View Full Code Here

          "xmlns='http://www.red.com'>" +
          "<b/>" +
          "</pre:a></root>");
        XMLReader parser = XMLReaderFactory.createXMLReader(
          "org.apache.xerces.parsers.SAXParser");
        XMLFilter filter = new XMLFilterImpl();
        filter.setParent(parser);
        Builder builder = new Builder(filter);
        Document doc = builder.build(reader)
        Element root = doc.getRootElement();
        Element prea = (Element) root.getChild(0);
        Element b = (Element) prea.getChild(0);
View Full Code Here

   
   
    public void testNonValidatingParserException() throws SAXException {
       
        XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
        XMLFilter filter = new NonValidatingFilter();
        filter.setParent(parser);
       
        try {
            new Builder(filter, true, null);
            fail("Validating with a non-validating parser");
        }
View Full Code Here

TOP

Related Classes of org.xml.sax.XMLFilter

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.