Package org.jdom

Examples of org.jdom.Element.detach()


    throws JDOMException, IOException, IllegalArgumentException, FeedException {
        // Parse entry into JDOM tree
        SAXBuilder builder = new SAXBuilder();
        Document entryDoc = builder.build(rd);
        Element fetchedEntryElement = entryDoc.getRootElement();
        fetchedEntryElement.detach();
       
        // Put entry into a JDOM document with 'feed' root so that Rome can handle it
        Feed feed = new Feed();
        feed.setFeedType(FEED_TYPE);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
View Full Code Here


                {
                    // remove the hidden input where name="formname" since a new one will be generated again when the xhtml is rendered.
                    Element formName = (Element)XPath.selectSingleNode( e, "INPUT[@name='formname']" );
                    if( formName != null )
                    {
                        formName.detach();
                    }

                    String name = e.getAttributeValue( "name" );

                    m_out.print( "\n[{FormOpen" );
View Full Code Here

    static Entry readEntry(String feedType, Reader reader) throws JDOMException, IOException, IllegalArgumentException,
        FeedException {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(reader);
        Element root = document.getRootElement();
        root.detach();
        Feed feed = new Feed();
        feed.setFeedType(feedType);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
        document = wireFeedOutput.outputJDom(feed);
        document.getRootElement().addContent(root);
View Full Code Here

    throws JDOMException, IOException, IllegalArgumentException, FeedException {
        // Parse entry into JDOM tree
        SAXBuilder builder = new SAXBuilder();
        Document entryDoc = builder.build(in);
        Element fetchedEntryElement = entryDoc.getRootElement();
        fetchedEntryElement.detach();
       
        // Put entry into a JDOM document with 'feed' root so that Rome can handle it
        Feed feed = new Feed();
        feed.setFeedType(FEED_TYPE);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
View Full Code Here

    /** Detach each xml element */
    @Override
    public void processElement(Wrapper<Element> elementWrapper) {
        Element content = elementWrapper.getContent();
        content.detach();
        content.removeContent();
    }

}
View Full Code Here

 
  private byte[] buildFinalXML(Document original, Set<ExtendElement> elements) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    Element root = (Element)original.getRootElement().clone();
    root.removeContent();
    Document doc = new Document((Element)root.detach(),
        original.getDocType(), original.getBaseURI());
    for(ExtendElement element : elements) {
      root.addContent(element.node.detach());
    }
    XMLOutputter xop = new XMLOutputter();
View Full Code Here

            for (int i=xmlToAdd.getDocument().getRootElement().getChildren().size()-1; i>=0; i--) {
                Element elementToAdd = ((Element)xmlToAdd.getDocument().getRootElement().getChildren().get(i));
                if ((elementToAdd.getName().equals(elementName)) && (xmlMain.findElement(elementName,"name", elementToAdd.getAttributeValue("name"))==null)) {
                    logger.debug("Adding "+elementName+" "+elementToAdd.getAttributeValue("name")+" to "+refElement.getParentElement().getName()+" at position "+position);
                    xmlMain.getDocument().getRootElement().getChildren().add(position,elementToAdd.detach());
                }
            }
        } else {
            logger.debug("There is no "+elementName+"-element in the main-template. Cannot add the elements.");
        }
View Full Code Here

    static Entry readEntry(String feedType, Reader reader) throws JDOMException, IOException, IllegalArgumentException,
        FeedException {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(reader);
        Element root = document.getRootElement();
        root.detach();
        Feed feed = new Feed();
        feed.setFeedType(feedType);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
        document = wireFeedOutput.outputJDom(feed);
        document.getRootElement().addContent(root);
View Full Code Here

    static Entry readEntry(String feedType, Reader reader) throws JDOMException, IOException, IllegalArgumentException,
        FeedException {
        SAXBuilder builder = new SAXBuilder();
        Document document = builder.build(reader);
        Element root = document.getRootElement();
        root.detach();
        Feed feed = new Feed();
        feed.setFeedType(feedType);
        WireFeedOutput wireFeedOutput = new WireFeedOutput();
        document = wireFeedOutput.outputJDom(feed);
        document.getRootElement().addContent(root);
View Full Code Here

            if (childElement.getName().endsWith("element")) {
                String newName = childElement.getName().substring(0, childElement.getName().indexOf("element"));
                childElement.setName(newName);
            }
            outputModSetElement.addContent(childElement.detach());
        }

        XMLOutputter outputter = new XMLOutputter("", false);
        outputter.setTextNormalize(true);
        return outputter.outputString(outputModSetElement);
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.