Examples of XMLFilterImpl


Examples of org.xml.sax.helpers.XMLFilterImpl

        String data = "<?xml version=\"1.0\"?>\n"
          + "<!DOCTYPE root [\n" +
                "  <!--comment-->\n  <!ELEMENT test (#PCDATA)>" +
            "\n  <!--comment-->\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

Examples of org.xml.sax.helpers.XMLFilterImpl

        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

Examples of org.xml.sax.helpers.XMLFilterImpl

     * @return The preprocess filter
     */
    protected XMLFilter getPreprocessFilter(String filename,
                                            ProgrammingLanguage language)
    {
        return new XMLFilterImpl();
    }
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

            SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");

            // old Ant-versions contain a bug in the XmlLogger that outputs
            // an invalid PI containing the target "xml:stylesheet"
            // instead of "xml-stylesheet": fix this
            XMLFilter piFilter = new XMLFilterImpl() {
                public void processingInstruction(String target, String data) throws SAXException {
                    if (target.equals("xml:stylesheet")) { target = "xml-stylesheet"; }
                    super.processingInstruction(target, data);
                }
            };
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

        private final Object contentObject;

        public Reader(Marshaller marshaller, Object contentObject) {
            this.marshaller = marshaller;
            this.contentObject = contentObject;
            repeater = new XMLFilterImpl();
        }
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

            if( schema!=null ) {
                // send the output to the validator as well
                ValidatorHandler validator = schema.newValidatorHandler();
                validator.setErrorHandler(new FatalAdapter(serializer));
                // work around a bug in JAXP validator in Tiger
                XMLFilterImpl f = new XMLFilterImpl() {
                    public void startPrefixMapping(String prefix, String uri) throws SAXException {
                        super.startPrefixMapping(prefix.intern(), uri.intern());
                    }
                };
                f.setContentHandler(validator);
                out = new ForkXmlOutput( new SAXOutput(f) {
                    @Override
                    public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws SAXException, IOException, XMLStreamException {
                        super.startDocument(serializer, false, nsUriIndex2prefixIndex, nsContext);
                    }
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

            if( schema!=null ) {
                // send the output to the validator as well
                ValidatorHandler validator = schema.newValidatorHandler();
                validator.setErrorHandler(new FatalAdapter(serializer));
                // work around a bug in JAXP validator in Tiger
                XMLFilterImpl f = new XMLFilterImpl() {
                    public void startPrefixMapping(String prefix, String uri) throws SAXException {
                        super.startPrefixMapping(prefix.intern(), uri.intern());
                    }
                };
                f.setContentHandler(validator);
                out = new ForkXmlOutput( new SAXOutput(f) {
                    @Override
                    public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws SAXException, IOException, XMLStreamException {
                        super.startDocument(serializer, false, nsUriIndex2prefixIndex, nsContext);
                    }
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

     *      This is a complete URL to be written inside &lt;Adress> element of the EPR,
     *      such as "http://foo.bar/abc/def"
     */
    public @NotNull WSEndpointReference createWithAddress(@NotNull final String newAddress) {
        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        XMLFilterImpl filter = new XMLFilterImpl() {
            private boolean inAddress = false;
            public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
                if(localName.equals("Address") && uri.equals(version.nsUri))
                    inAddress = true;
                super.startElement(uri,localName,qName,atts);
            }

            public void characters(char ch[], int start, int length) throws SAXException {
                if(!inAddress)
                    super.characters(ch, start, length);
            }


            public void endElement(String uri, String localName, String qName) throws SAXException {
                if(inAddress)
                    super.characters(newAddress.toCharArray(),0,newAddress.length());
                inAddress = false;
                super.endElement(uri, localName, qName);
            }
        };
        filter.setContentHandler(xsb.createFromSAXBufferCreator());
        try {
            infoset.writeTo(filter,false);
        } catch (SAXException e) {
            throw new AssertionError(e); // impossible since we are writing from XSB to XSB.
        }
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

    log = RedmineApiPlugin.getLogService(JaxbParser.class);
  }
 
  public T parseInputStream(InputStream stream) throws RedmineApiErrorException {
    try {
      XMLFilterImpl filter = new RedminePluginFilter();
      SAXSource source = new SAXSource(filter, new InputSource(stream));

      return parseInputStream(source);
     
    } catch (ParserConfigurationException e) {
View Full Code Here

Examples of org.xml.sax.helpers.XMLFilterImpl

      JaxbParser<?> parser = successParser;
      if (sc==HttpStatus.SC_UNPROCESSABLE_ENTITY) {
        parser = errorParser;
      }
   
      XMLFilterImpl filter = new MissingNamespaceFilter();
      SAXSource source = new SAXSource(filter, new InputSource(input));
     
      return parser.parseInputStream(source);
    } catch (Exception e) {
      throw new RedmineApiErrorException(Messages.ERRMSG_INPUTSTREAM_PARSING_FAILED, e);
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.