Package org.jdom.filter

Examples of org.jdom.filter.ContentFilter



    public void startDocument() {
        _sb.append("<?xml version=\"1.0\" encoding=\"" + _encoding + "\"?>\n");

        List pis = _dom.getDoc().getContent(new ContentFilter(ContentFilter.PI));
        for (Iterator it = pis.iterator(); it.hasNext();) {
            ProcessingInstruction pi = (ProcessingInstruction) it.next();
            _sb.append("<?" + pi.getTarget() + " " + pi.getValue() + "?>\n");
        }
    }
View Full Code Here



    public void startDocument() {
        _sb.append("<?xml version=\"1.0\" encoding=\"" + _encoding + "\"?>\n");

        List pis = _dom.getDoc().getContent(new ContentFilter(ContentFilter.PI));
        for (Iterator it = pis.iterator(); it.hasNext();) {
            ProcessingInstruction pi = (ProcessingInstruction) it.next();
            _sb.append("<?" + pi.getTarget() + " " + pi.getValue() + "?>\n");
        }
    }
View Full Code Here

      }
    }
  }

  private void normaliseLineEndings(Document document) {
    for (Iterator i = document.getDescendants(new ContentFilter(ContentFilter.COMMENT)); i.hasNext();) {
      Comment c = (Comment) i.next();
      c.setText(c.getText().replaceAll("\n", SEPARATOR));
    }
  }
View Full Code Here

      addRendererElement(componentInfo, componentTag, renderer, namespace);
    }
  }

  private void normaliseLineEndings(Document document) {
    Iterator i = document.getDescendants(new ContentFilter(ContentFilter.COMMENT));
    while (i.hasNext()) {
      Comment c = (Comment) i.next();
      c.setText(c.getText().replaceAll("\n", SEPARATOR));
    }
  }
View Full Code Here

        }
    }

    private void normaliseLineEndings( Document document )
    {
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); )
        {
            Comment c = (Comment) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); )
        {
            CDATA c = (CDATA) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
    }
View Full Code Here

            List siblings = null;
            int nodeType = ContentFilter.TEXT;
            StringBuffer path = getElementPath(from, parent, false);

            if (parent != null) {
                siblings = parent.getContent(new ContentFilter(nodeType));
            }
            else {
                Document doc = to.getDocument();
                if (doc != null) {
                    siblings = doc.getContent(new ContentFilter(nodeType));
                }
            }
            return getPositionPath(to, siblings, "text()", path).toString();
        }
    }
View Full Code Here

            List siblings = null;
            int nodeType = ContentFilter.COMMENT;
            StringBuffer path = getElementPath(from, parent, false);

            if (parent != null) {
                siblings = parent.getContent(new ContentFilter(nodeType));
            }
            else {
                Document doc = to.getDocument();
                if (doc != null) {
                    siblings = doc.getContent(new ContentFilter(nodeType));
                }
            }
            return getPositionPath(to, siblings, "comment()", path).toString();
        }
    }
View Full Code Here

            List siblings = null;
            int nodeType = ContentFilter.PI;
            StringBuffer path = getElementPath(from, parent, false);

            if (parent != null) {
                siblings = parent.getContent(new ContentFilter(nodeType));
            }
            else {
                Document doc = to.getDocument();
                if (doc != null) {
                    siblings = doc.getContent(new ContentFilter(nodeType));
                }
            }
            return getPositionPath(to, siblings,
                                   "processing-instruction()", path).toString();
        }
View Full Code Here

        }
    }

    private void normaliseLineEndings( Document document )
    {
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.COMMENT ) ); i.hasNext(); )
        {
            Comment c = (Comment) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
        for ( Iterator<?> i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); )
        {
            CDATA c = (CDATA) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
    }
View Full Code Here

        Element parent = text.getParent();

        int size = 0;
        int index = 0;
        if (parent != null) {
            Filter filter = new ContentFilter(ContentFilter.TEXT);
            List content = parent.getContent(filter);
            size = content.size();
            index = content.indexOf(text);
        }
        StringBuffer path = new StringBuffer();
View Full Code Here

TOP

Related Classes of org.jdom.filter.ContentFilter

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.