Package org.jdom.filter

Examples of org.jdom.filter.Filter


    Document doc = builder.build(nexusFile)
    assertTrue("Empty doc.", doc != null);
    Element root = doc.getRootElement();
    Namespace ns = Namespace.getNamespace("");
    XPath xPath = XPath.newInstance("entity");
    Filter eleFilter = new ElementFilter("entity", null);
   
    // 6. verify search:
    //List<Element> allEles = xPath.selectNodes(doc);
    Iterator<Element> iter = doc.getDescendants(eleFilter);
    Element ele = iter.next();
View Full Code Here


    private boolean removeKeyword(final String keyword, final String language,
            final String vocabulary) {
        checkKeyword(keyword);
        final String text = buildKeyword(keyword, language, vocabulary);
        return (keywordsListEncoder.removeContent(new Filter() {
            private static final long serialVersionUID = 1L;

            public boolean matches(Object obj) {
                if (((Element) obj).getText().equals(text)) {
                    return true;
View Full Code Here

      final String val) throws IllegalArgumentException {
    if (root == null || name == null || val == null) {
      throw new IllegalArgumentException("Bad arguments: root=" + root
          + " name=" + name + " val=" + val);
    }
    final Filter filter = new Filter() {
      private static final long serialVersionUID = 1L;

      public boolean matches(Object obj) {
        if (obj instanceof Element) {
          final Element el = ((Element) obj);
View Full Code Here

    if (root == null || name == null) {
      throw new IllegalArgumentException("Bad arguments: root=" + root
          + " name=" + name);
    }

    final Filter filter = new Filter() {
      private static final long serialVersionUID = 1L;

      public boolean matches(Object obj) {
        if (obj instanceof Element) {
          final Element el = ((Element) obj);
View Full Code Here

      throws IllegalArgumentException {
    if (root == null || el == null) {
      throw new IllegalArgumentException("Bad arguments: root=" + root
          + " element=" + el);
    }
    final Filter filter = new Filter() {
      /**
       *
       */
      private static final long serialVersionUID = 1L;

View Full Code Here

   * @return true if the keycolumn was removed
   */
  public boolean delKeyColumn(final String keycolumn){
    final Element el = new Element(KEYCOLUMN);
    el.setText(keycolumn);
    return (this.getRoot().removeContent(new Filter() {
      private static final long serialVersionUID = 1L;

      public boolean matches(Object obj) {
        if (((Element) obj).getText().equals(keycolumn)) {
          return true;
View Full Code Here

   * @return true if something is removed, false otherwise
   */
  public boolean delStyle(final String style) {
    final Element el = new Element("style");
    el.setText(style);
    return (stylesEncoder.removeContent(new Filter() {
      private static final long serialVersionUID = 1L;

      public boolean matches(Object obj) {
        if (((Element) obj).getText().equals(style)) {
          return true;
View Full Code Here

    elevationDimension.setPresentation(
        Presentation.DISCRETE_INTERVAL, BigDecimal.valueOf(12));

    List<Element> elList = ElementUtils.search(
        elevationDimension.getRoot(), new Filter() {
          public boolean matches(Object obj) {
            if (obj instanceof Element) {
              final Element el = ((Element) obj);
              if (el.getName().equals(
                  GSDimensionInfoEncoder.DIMENSIONINFO)) {
                return true;
              }
            }
            return false;
          }
        });
    // using set we get only one element called
    // Presentation.DISCRETE_INTERVAL
    Assert.assertEquals(elList.size(), 1);

   
    elevationDimension.setPresentation(Presentation.LIST);
   
    // this kind of presentation do not support a resolution parameter
    elList = ElementUtils.search(
        elevationDimension.getRoot(), new Filter() {
          public boolean matches(Object obj) {
            if (obj instanceof Element) {
              final Element el = ((Element) obj);
              if (el.getName().equals(
                  GSDimensionInfoEncoder.RESOLUTION)) {
View Full Code Here

    Assert.assertEquals(1,list.size());
   
    final List<Element> list2=ElementUtils.search(this.root, filter, 6);
    Assert.assertEquals(maxDepth,list2.size());
   
    final Filter myFilter=new Filter() {
      public boolean matches(Object obj) {
        if (obj instanceof Element){
          final Element el=((Element)obj);
          if (el.getName().equals(NAME)){
            if (el.getText().equals("1") || el.getText().equals("3"))
View Full Code Here

TOP

Related Classes of org.jdom.filter.Filter

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.