Package org.jdom.xpath

Examples of org.jdom.xpath.XPath


    }

    //ein Job Chain hat entweder job_chain_node ODER job_chain_node.job_chain Kindknoten.
    private boolean check() {
      try {
        XPath x3 = XPath.newInstance("//job_chain[@name='"+ listener.getChainName() + "']/job_chain_node.job_chain");
       
        List listOfElement_3 = x3.selectNodes(dom.getDoc());
        if(listOfElement_3.isEmpty())
          return true;
        else
          return false;
      } catch (Exception e) {
View Full Code Here


        final SAXBuilder builder = new SAXBuilder( false );

        final Document doc = builder.build( fca.getFile() );

        final XPath role = XPath.newInstance( "//component[position()=1]/role/text()" );
        final XPath hint = XPath.newInstance( "//component[position()=1]/role-hint/text()" );
        final XPath implementation = XPath.newInstance( "//component[position()=1]/implementation/text()" );

        assertEquals( "role", ( (Text) role.selectSingleNode( doc ) ).getText() );
        assertNull( hint.selectSingleNode( doc ) );
        assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );
    }
View Full Code Here

        final SAXBuilder builder = new SAXBuilder( false );

        final Document doc = builder.build( fca.getFile() );

        final XPath role = XPath.newInstance( "//component[position()=1]/role/text()" );
        final XPath hint = XPath.newInstance( "//component[position()=1]/role-hint/text()" );
        final XPath implementation = XPath.newInstance( "//component[position()=1]/implementation/text()" );

        assertEquals( "role", ( (Text) role.selectSingleNode( doc ) ).getText() );
        assertEquals( "hint", ( (Text) hint.selectSingleNode( doc ) ).getText() );
        assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );
    }
View Full Code Here

        final SAXBuilder builder = new SAXBuilder( false );

        final Document doc = builder.build( fca.getFile() );

        final XPath role = XPath.newInstance( "//component[position()=1]/role/text()" );
        final XPath hint = XPath.newInstance( "//component[position()=1]/role-hint/text()" );
        final XPath implementation = XPath.newInstance( "//component[position()=1]/implementation/text()" );

        assertEquals( "role", ( (Text) role.selectSingleNode( doc ) ).getText() );
        assertEquals( "hint", ( (Text) hint.selectSingleNode( doc ) ).getText() );
        assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );

        final XPath role2 = XPath.newInstance( "//component[position()=2]/role/text()" );
        final XPath hint2 = XPath.newInstance( "//component[position()=2]/role-hint/text()" );
        final XPath implementation2 = XPath.newInstance( "//component[position()=2]/implementation/text()" );

        assertEquals( "role", ( (Text) role2.selectSingleNode( doc ) ).getText() );
        assertEquals( "hint2", ( (Text) hint2.selectSingleNode( doc ) ).getText() );
        assertEquals( "impl", ( (Text) implementation2.selectSingleNode( doc ) ).getText() );

    }
View Full Code Here

        final SAXBuilder builder = new SAXBuilder( false );

        final Document doc = builder.build( descriptorFile );

        final XPath role = XPath.newInstance( "//component[position()=1]/role/text()" );
        final XPath hint = XPath.newInstance( "//component[position()=1]/role-hint/text()" );
        final XPath implementation = XPath.newInstance( "//component[position()=1]/implementation/text()" );

        assertEquals( "role", ( (Text) role.selectSingleNode( doc ) ).getText() );
        assertEquals( "hint", ( (Text) hint.selectSingleNode( doc ) ).getText() );
        assertEquals( "impl", ( (Text) implementation.selectSingleNode( doc ) ).getText() );

        final XPath role2 = XPath.newInstance( "//component[position()=2]/role/text()" );
        final XPath hint2 = XPath.newInstance( "//component[position()=2]/role-hint/text()" );
        final XPath implementation2 = XPath.newInstance( "//component[position()=2]/implementation/text()" );

        assertEquals( "role", ( (Text) role2.selectSingleNode( doc ) ).getText() );
        assertEquals( "hint2", ( (Text) hint2.selectSingleNode( doc ) ).getText() );
        assertEquals( "impl", ( (Text) implementation2.selectSingleNode( doc ) ).getText() );

    }
View Full Code Here

  }
 
  public List<ToolIdentity> createFileIdentities(Document dom, ToolInfo info) {
    List<ToolIdentity> identities = new ArrayList<ToolIdentity>();
    try {
      XPath xpath = XPath.newInstance("//fits:identity");
      Namespace ns = Namespace.getNamespace("fits",Fits.XML_NAMESPACE);
      xpath.addNamespace(ns);
      List<Element> identElements = xpath.selectNodes(dom);
      for(Element element : identElements) {
        Attribute formatAttr = element.getAttribute("format");
        Attribute mimetypeAttr = element.getAttribute("mimetype");
        Element versionElement = element.getChild("version",ns);
       
View Full Code Here

    }
  }
 
  public FitsMetadataElement getMetadataElement(String name) {
    try {     
      XPath xpath = XPath.newInstance("//fits:"+name);
      xpath.addNamespace("fits",Fits.XML_NAMESPACE);
      Element node = (Element)xpath.selectSingleNode(fitsXml);
      if(node != null) {
        FitsMetadataElement element = buildMetdataIElements(node);
        return element;
      }
    } catch (JDOMException e) {
View Full Code Here

 
  @SuppressWarnings("unchecked")
  public List<FitsMetadataElement> getMetadataElements(String name) {
    List<FitsMetadataElement> elements = new ArrayList<FitsMetadataElement>();
    try {
      XPath xpath = XPath.newInstance("//fits:"+name);
      xpath.addNamespace("fits",Fits.XML_NAMESPACE);
      List<Element> nodes = xpath.selectNodes(fitsXml);
      for(Element e : nodes) {
        elements.add(buildMetdataIElements(e));
      }
      return elements;
    } catch (JDOMException e) {
View Full Code Here

   
  @SuppressWarnings("unchecked")
  public List<FitsIdentity> getIdentities() {
    List<FitsIdentity> identities = new ArrayList<FitsIdentity>();
    try {
      XPath xpath = XPath.newInstance("//fits:identity");
      Namespace ns = Namespace.getNamespace("fits",Fits.XML_NAMESPACE);
      xpath.addNamespace(ns);
      List<Element> identElements = xpath.selectNodes(fitsXml);
      for(Element element : identElements) {
        FitsIdentity fileIdentSect = new FitsIdentity();
       
        //get the identity attributes
        Attribute formatAttr = element.getAttribute("format");
View Full Code Here

    for(ToolOutput result : results) {     
      Document dom = result.getFitsXml();
      try {
        //only look at non null dom structures
        if(dom != null) {
          XPath xpath = XPath.newInstance(xpath_query);
          xpath.addNamespace("fits",Fits.XML_NAMESPACE);
          Element e = (Element)xpath.selectSingleNode(dom);
          if(e != null && e.getChildren().size() > 0) {
            if(useChildren) {
              e = (Element)e.getChildren().get(0);
            }
            List children = e.getChildren();
View Full Code Here

TOP

Related Classes of org.jdom.xpath.XPath

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.