Examples of ElementFilter


Examples of org.jdom.filter.ElementFilter

            Log.debug(Geonet.SCHEMA_MANAGER, "Matching " + needle.toString());

    if (checkNamespacesOnElement(needle,haystack)) return true;

    @SuppressWarnings("unchecked")
        Iterator<Element> haystackIterator = haystack.getDescendants(new ElementFilter());
    while(haystackIterator.hasNext()){
      Element tempElement = haystackIterator.next();
      if (checkNamespacesOnElement(needle,tempElement)) return true;
    }
    
View Full Code Here

Examples of org.jdom.filter.ElementFilter

     * @return
    */
  private boolean isMatchingElementInMetadata(Element needle, Element haystack, boolean checkValue) {
    boolean returnVal = false;
    @SuppressWarnings("unchecked")
        Iterator<Element> haystackIterator = haystack.getDescendants(new ElementFilter());
   
    String needleName = needle.getName();
    Namespace needleNS = needle.getNamespace();
        if(Log.isDebugEnabled(Geonet.SCHEMA_MANAGER))
            Log.debug(Geonet.SCHEMA_MANAGER, "Matching " + Xml.getString(needle));
View Full Code Here

Examples of org.jdom.filter.ElementFilter

     * @return
     */
  public int findMaximumRef(Element md) {
    int iRef = 0;
    @SuppressWarnings("unchecked")
        Iterator<Element> mdIt = md.getDescendants(new ElementFilter("element"));
    while (mdIt.hasNext()) {
      Element elem = mdIt.next();
      String ref = elem.getAttributeValue("ref");
      if (ref != null) {
        int i = Integer.parseInt(ref);
View Full Code Here

Examples of org.jdom.filter.ElementFilter

    Element result = null;
    if (parent != null) {
      int me = parent.indexOf(el);

      //--- check and see whether the element to be deleted is the last one of its kind
      Filter elFilter = new ElementFilter(uName,ns);
      if (parent.getContent(elFilter).size() == 1) {

        //--- get geonet child element with attribute name = unqualified name
        Filter chFilter = new ElementFilter(Edit.RootChild.CHILD, Edit.NAMESPACE);
        @SuppressWarnings("unchecked")
                List<Element> children = parent.getContent(chFilter);

        for (Element ch : children) {
          String name = ch.getAttributeValue("name");
View Full Code Here

Examples of org.jdom.filter.ElementFilter

     * </code></pre>
     *
     * @param errorReport
     */
    static void restructureReportToHavePatternRuleHierarchy(Element errorReport) {
        final Iterator patternFilter = errorReport.getDescendants(new ElementFilter(EL_ACTIVE_PATTERN, Geonet.Namespaces.SVRL));
        @SuppressWarnings("unchecked")
        List<Element> patterns = Lists.newArrayList(patternFilter);
        for (Element pattern : patterns) {
            final Element parentElement = pattern.getParentElement();
            Element currentRule = null;
View Full Code Here

Examples of org.jdom.filter.ElementFilter

                    Element xmlReport = Xml.transform(md, schemaTronXmlXslt, params);
                    if (xmlReport != null) {
                        report.addContent(xmlReport);
                        // add results to persitent validation information
                        int firedRules = 0;
                        Iterator<?> firedRulesElems = xmlReport.getDescendants(new ElementFilter ("fired-rule", Namespaces.SVRL));
                        while (firedRulesElems.hasNext()) {
                            firedRulesElems.next();
                            firedRules ++;
                        }
                        int invalidRules = 0;
                        Iterator<?> faileAssertElements = xmlReport.getDescendants(new ElementFilter ("failed-assert",
                                Namespaces.SVRL));
                        while (faileAssertElements.hasNext()) {
                            faileAssertElements.next();
                            invalidRules ++;
                        }
View Full Code Here

Examples of org.jdom.filter.ElementFilter

                        if (xmlReport != null) {
                            report.addContent(xmlReport);
                            // add results to persistent validation information
                            int firedRules = 0;
                            @SuppressWarnings("unchecked")
                            Iterator<Element> i = xmlReport.getDescendants(new ElementFilter ("fired-rule", Namespaces.SVRL));
                            while (i.hasNext()) {
                                i.next();
                                firedRules ++;
                            }
                            int invalidRules = 0;
                            i = xmlReport.getDescendants(new ElementFilter ("failed-assert", Namespaces.SVRL));
                            while (i.hasNext()) {
                                i.next();
                                invalidRules ++;
                            }
                            Integer[] results = {invalidRules!=0?ifNotValid:1, firedRules, invalidRules};
View Full Code Here

Examples of org.jdom.filter.ElementFilter

///////////////////////////////////////////////////////////////////////////////////////////////////////

    public static String[] parsePackagePath(final Element element) {
        SortedSet<Element> packagePathElementSortedSet = new TreeSet<Element>(JdomTreePositionComparator.getInstance());

        for (Iterator iterator = element.getDescendants(new ElementFilter(JavaSourceTokenType.IDENT.getName()));
             iterator.hasNext(); ) {
            packagePathElementSortedSet.add((Element) iterator.next());

        }
View Full Code Here

Examples of org.jdom.filter.ElementFilter

    @SuppressWarnings("unchecked")
    public AnnotationJdom(Element annotationElement) {
        this.annotationElement = annotationElement;
        this.name = annotationElement.getAttribute(JdomTreeAdaptor.ID_ATTR).getValue();
        final Iterator<Element> iterator = annotationElement.getDescendants(
                new ElementFilter(JavaSourceTokenType.ANNOTATION_INIT_DEFAULT_KEY.name()));
        if (iterator.hasNext()) {
            defaultParameter = getAnnotationValueForElement(iterator.next());
            parameterMap = Collections.emptyMap();
        }
        else {
            defaultParameter = null;
            final Iterator<Element> keysIterator = annotationElement.getDescendants(
                    new ElementFilter(JavaSourceTokenType.ANNOTATION_INIT_KEY_LIST.name()));
            if (keysIterator.hasNext()) {
                final List<Element> elementList = keysIterator.next().getChildren(JavaSourceTokenType.IDENT.name());
                parameterMap = new HashMap<String, String>((int) (elementList.size() * 1.5), 0.9f);
                for (Element element : elementList) {
                    String value = getAnnotationValueForElement(element);
View Full Code Here

Examples of org.jdom2.filter.ElementFilter

    try
    {
      Document xml=this.loadURL(url);
      if(language.equals("en"))
      {
        for(Element div:xml.getDescendants(new ElementFilter("a")))
        {
          if(div.getAttributeValue("href")!=null&&div.getAttributeValue("href").equals("/wiki/Special:Statistics"))
          {
            String str=div.getValue();
            System.out.println(str);
            this.glossCount=Double.parseDouble(str.replace(",", ""));
            break;
          }
        }
      }
      else
      {
        for(Element div:xml.getDescendants(new ElementFilter("li")))
        {
          if(div.getAttributeValue("id")!=null && div.getAttributeValue("id").contains("lang-"))
          {
            for(Element span:div.getDescendants(new ElementFilter("span")))
            {
              if(span.getAttributeValue("lang").equals(language))
              {
                String str=div.getValue();
                str=str.substring(0,str.indexOf(" articles"));
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.