Package javax.xml.transform.sax

Examples of javax.xml.transform.sax.TransformerHandler


        format.put(OutputKeys.METHOD, "xml");

        SAXTransformerFactory factory = getTransformerFactory();

        TransformerHandler serializer = factory.newTransformerHandler();
        serializer.getTransformer().setOutputProperties(format);
        serializer.setResult(new StreamResult(outFile));

        this.parser = new ExtendedDirectParserProcessor();
        this.parser.setLog(log);
        this.parser.setFlatten(this.flatten);
View Full Code Here


        format.put(OutputKeys.METHOD, "xml");

        SAXTransformerFactory factory = getTransformerFactory();

        TransformerHandler serializer = factory.newTransformerHandler();
        serializer.getTransformer().setOutputProperties(format);
        serializer.setResult(new StreamResult(outFile));

        if (this.parserautomaton!=null// && (this.parser==null))
        {
          this.parser = new ParserProcessor();
          this.parser.setLog(log);
View Full Code Here

      format.put(OutputKeys.METHOD, "xml");

      SAXTransformerFactory factory = getTransformerFactory();

      TransformerHandler serializer = factory.newTransformerHandler();
      serializer.getTransformer().setOutputProperties(format);
      serializer.setResult(new StreamResult(outFile));

      /*if (this.parserautomaton!=null)
        this.parseradapter.setContentHandler(serializer);
      else
        this.lexicaladapter.setContentHandler(serializer);*/
 
View Full Code Here

   *           If the transformer can't be created.
   */
  private TransformerHandler getTransformerHandler(
      Source transformationInstruction) throws SerializerException {

    TransformerHandler transHand;

    try {
      if (transformationInstruction != null) {
        // if transformation instructions are given explicitely, then use them.
        transHand = _saxTransFact
View Full Code Here

   *           If the transformer can't be created.
   */
  private TransformerHandler getTransformerHandler(Templates template)
      throws SerializerException {

    TransformerHandler transHand;

    try {
      if (template != null) {
        // use a template if one is given
        transHand = _saxTransFact.newTransformerHandler(template);
View Full Code Here

        //saxFactory.setAttribute("http://xml.org/sax/features/namespace-prefixes", false);
        // saxFactory.setAttribute("http://xml.org/sax/features/namespaces", false);
        //saxFactory.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
        // xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
       
        TransformerHandler handler
          = saxFactory.newTransformerHandler();
       
        handler.setResult(new DOMResult(doc));

        if (filter != null) {
          filter.setParent(xmlReader);
          filter.setContentHandler(handler);
View Full Code Here

          {
            AVT avt = ((ElemLiteralResult)ssNode).getLiteralResultAttribute("href");
            String href = avt.evaluate(xctxt,xt, elem);
            String absURI = SystemIDResolver.getAbsoluteURI(href, sysId);
            Templates tmpl = saxTFactory.newTemplates(new StreamSource(absURI));
            TransformerHandler tHandler = saxTFactory.newTransformerHandler(tmpl);
            Transformer trans = tHandler.getTransformer();
           
            // AddTransformerHandler to vector
            vTHandler.addElement(tHandler);

            paramNodes = ssNode.getChildNodes();
View Full Code Here

  public void usePipe(Vector vTHandler, String source, String target)
          throws TransformerException, TransformerConfigurationException,
                 FileNotFoundException, IOException, SAXException, SAXNotRecognizedException
  {
    XMLReader reader = XMLReaderFactory.createXMLReader();
    TransformerHandler tHFirst = (TransformerHandler)vTHandler.firstElement();
    reader.setContentHandler(tHFirst);
    reader.setProperty("http://xml.org/sax/properties/lexical-handler", tHFirst);
    for (int i = 1; i < vTHandler.size(); i++)
    {
      TransformerHandler tHFrom = (TransformerHandler)vTHandler.elementAt(i-1);
      TransformerHandler tHTo = (TransformerHandler)vTHandler.elementAt(i);
      tHFrom.setResult(new SAXResult(tHTo));     
    }
    TransformerHandler tHLast = (TransformerHandler)vTHandler.lastElement();
    Transformer trans = tHLast.getTransformer();
    Properties outputProps = trans.getOutputProperties();
    Serializer serializer = SerializerFactory.getSerializer(outputProps);
    serializer.setOutputStream(new FileOutputStream(target));
    tHLast.setResult(new SAXResult(serializer.asContentHandler()));
   
    reader.parse(source);
  }
View Full Code Here

  {
    try {
      TransformerImpl transformer =
        (TransformerImpl) templates.newTransformer();
      transformer.setURIResolver(m_uriResolver);
      TransformerHandler th =
        (TransformerHandler) transformer.getInputContentHandler(true);

      return th;
    } catch( TransformerConfigurationException ex ) {
      if( m_errorListener != null ) {
View Full Code Here

             
              if (!useXSLTC)
                stf.setAttribute(org.apache.xalan.processor.TransformerFactoryImpl.FEATURE_INCREMENTAL,
                   Boolean.TRUE);
                
              TransformerHandler th = stf.newTransformerHandler(stylesheet);
             
              reader.setContentHandler(th);
              reader.setDTDHandler(th);
             
              if(th instanceof org.xml.sax.ErrorHandler)
                reader.setErrorHandler((org.xml.sax.ErrorHandler)th);
             
              try
              {
                reader.setProperty(
                  "http://xml.org/sax/properties/lexical-handler", th);
              }
              catch (org.xml.sax.SAXNotRecognizedException e){}
              catch (org.xml.sax.SAXNotSupportedException e){}
              try
              {
                reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                  true);
              } catch (org.xml.sax.SAXException se) {}
       
              try
              {
                reader.setFeature("http://apache.org/xml/features/validation/dynamic",
                                  true);
              } catch (org.xml.sax.SAXException se) {}
             
              th.setResult(strResult);
             
              reader.parse(new InputSource(inFileName));
              }                           
            }
            else
View Full Code Here

TOP

Related Classes of javax.xml.transform.sax.TransformerHandler

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.