Package org.jdom2.output

Examples of org.jdom2.output.XMLOutputter


            DOMBuilder domBuilder = new DOMBuilder();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return domBuilder.build((org.w3c.dom.Element) node);
            }
            else if (node.getNodeType() == Node.DOCUMENT_NODE) {
                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(requestPayload, jdomResult);
View Full Code Here


    }

    @Override
    protected void testArgument(Object argument, MethodParameter parameter) {
        assertTrue("argument not a element", argument instanceof Element);
        Element node = (Element) argument;
        assertEquals("Invalid namespace", NAMESPACE_URI, node.getNamespaceURI());
        assertEquals("Invalid local name", LOCAL_NAME, node.getName());
    }
View Full Code Here

        assertEquals("Invalid local name", LOCAL_NAME, node.getName());
    }

    @Override
    protected Element getReturnValue(MethodParameter returnType) {
        return new Element(LOCAL_NAME, NAMESPACE_URI);
    }
View Full Code Here

            @Override
            protected Element invokeInternal(Element requestElement) throws Exception {
                assertNotNull("No requestElement passed", requestElement);
                assertEquals("Invalid request element", REQUEST_ELEMENT, requestElement.getName());
                assertEquals("Invalid request element", NAMESPACE_URI, requestElement.getNamespaceURI());
                return new Element(RESPONSE_ELEMENT, Namespace.getNamespace("tns", NAMESPACE_URI));
            }
        };
    }
View Full Code Here

        return supports(returnType);
    }

    @Override
    protected Source createResponsePayload(MethodParameter returnType, Object returnValue) {
        Element returnedElement = (Element) returnValue;
        return new JDOMSource(returnedElement);
    }
View Full Code Here

    @Override
    protected Element resolveRequestPayloadArgument(MethodParameter parameter, Source requestPayload) throws Exception {
        if (requestPayload instanceof DOMSource) {
            Node node = ((DOMSource) requestPayload).getNode();
            DOMBuilder domBuilder = new DOMBuilder();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return domBuilder.build((org.w3c.dom.Element) node);
            }
            else if (node.getNodeType() == Node.DOCUMENT_NODE) {
                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
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

TOP

Related Classes of org.jdom2.output.XMLOutputter

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.