Package org.jdom2.transform

Examples of org.jdom2.transform.JDOMResult


      {
        System.out.println("-----------Checking file: "+file.getName()+ " "+String.valueOf(x)+"/"+String.valueOf(files.size())+"--------------");
        x++;
        try
        {
          SAXBuilder builder=new SAXBuilder();
          Document xml=(Document)builder.build(file);
          ArrayList<Element> words=new ArrayList<Element>();
          for(Element word:xml.getDescendants(new ElementFilter("wf")))
            words.add(word);
          for(int w=0;w<words.size();w++)
          {
View Full Code Here


     * @throws JDOMException
     * @throws IOException
     */
    private Element htmlStringToElement( String html ) throws JDOMException, IOException
    {
        SAXBuilder builder = new SAXBuilder( CYBERNEKO_PARSER, true );
        Document doc = builder.build( new StringReader( html ) );
        Element element = doc.getRootElement();
        return element;
    }
View Full Code Here

            try
            {
                Element root = layout.getAsElement();
                File file = new File(layout.name + ".xml");
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                Format format = Format.getPrettyFormat();
                format.setEncoding("utf-16");
                format.setTextMode(Format.TextMode.TRIM);
                XMLOutputter outputter = new XMLOutputter(format);
                outputter.output(new Document(root), fileOutputStream);
                fileOutputStream.close();
            } catch (Exception e)
            {
View Full Code Here

        CustomXMLOutputProcessor processor = new CustomXMLOutputProcessor();
        XMLOutputter output = new XMLOutputter(processor);
       
        StringWriter out = new StringWriter();
       
        Format fmt = Format.getRawFormat();
        fmt.setExpandEmptyElements( false );
        fmt.setLineSeparator( LINEBREAK );

        output.setFormat( fmt );
        output.outputElementContent( m_document.getRootElement(), out );
       
        String result = out.toString();
View Full Code Here

                File file = new File(layout.name + ".xml");
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                Format format = Format.getPrettyFormat();
                format.setEncoding("utf-16");
                format.setTextMode(Format.TextMode.TRIM);
                XMLOutputter outputter = new XMLOutputter(format);
                outputter.output(new Document(root), fileOutputStream);
                fileOutputStream.close();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
View Full Code Here

   */
  private void saveXML()
  {
     try
     {
        XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
        sortie.output(this.root, new FileOutputStream(SQCalculator.xmlPath));
     }
     catch (java.io.IOException e){}
  }
View Full Code Here

   */
  private void saveXML()
  {
     try
     {
        XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
        sortie.output(la.root, new FileOutputStream(Language.xmlPath));
     }
     catch (java.io.IOException e){}
  }
View Full Code Here

                  SemCorCleaner.checkSenses(word, l);
                }
              }
            }         
          }
          XMLOutputter xmlOutput = new XMLOutputter();
          //display nice
          xmlOutput.setFormat(Format.getPrettyFormat());
          xmlOutput.output(xml, new FileWriter(file));
          System.out.println("------------Correction finished for "+file.getName()+"-------------------------");
        }
        catch(JDOMException e)
        {
          file.deleteOnExit();
View Full Code Here

     @return HTML
     */
    public static String element2String( Element element )
    {
        Document document = new Document( element );
        XMLOutputter outputter = new XMLOutputter();
        return outputter.outputString( document );
    }
View Full Code Here

        throws IOException
    {
        m_document.setContext( m_context );

        CustomXMLOutputProcessor processor = new CustomXMLOutputProcessor();
        XMLOutputter output = new XMLOutputter(processor);
       
        StringWriter out = new StringWriter();
       
        Format fmt = Format.getRawFormat();
        fmt.setExpandEmptyElements( false );
        fmt.setLineSeparator( LINEBREAK );

        output.setFormat( fmt );
        output.outputElementContent( m_document.getRootElement(), out );
       
        String result = out.toString();
        return result;
    }
View Full Code Here

TOP

Related Classes of org.jdom2.transform.JDOMResult

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.