Package org.jaxen.dom4j

Examples of org.jaxen.dom4j.Dom4jXPath


  public String getObjectClassName( String objectId ) {
    try {
      String xPath = MessageFormat.format( BEAN_ID_XPATH, objectId );
      HashMap<String, String> map = new HashMap<String, String>();
      map.put( "default", DEFAULT_NAMESPACE ); //$NON-NLS-1$
      Dom4jXPath xpath = new Dom4jXPath( xPath );
      xpath.setNamespaceContext( new SimpleNamespaceContext( map ) );
      Element element = (Element) xpath.selectSingleNode( document );
      return element.attributeValue( CLASS_ATTRIBUTE );
    } catch ( JaxenException jex ) {
      return null;
    }
  }
View Full Code Here


  public String getObjectScope( String objectId ) {
    try {
      HashMap<String, String> map = new HashMap<String, String>();
      map.put( "default", DEFAULT_NAMESPACE ); //$NON-NLS-1$
      Dom4jXPath xpath = new Dom4jXPath( BEAN_ID_XPATH );
      xpath.setNamespaceContext( new SimpleNamespaceContext( map ) );
      Element element = (Element) xpath.selectSingleNode( document );
      return element.attributeValue( SCOPE_ATTRIBUTE );
    } catch ( JaxenException jex ) {
      return null;
    }
View Full Code Here

        return xpath;
    }

    protected Dom4jXPath getDom4jXPath() throws JaxenException
    {
        Dom4jXPath xpath = new Dom4jXPath(pattern);
        setupNamespaces(xpath);
        return xpath;
    }
View Full Code Here

        {
            return new DOMXPath(expression);
        }
        else if (createDom4jXPath(object))
        {
            return new Dom4jXPath(expression);
        }
        else
        {
            throw new IllegalArgumentException(XmlMessages.domTypeNotSupported(object.getClass()).getMessage());
        }
View Full Code Here

        {
            SAXReader reader = new SAXReader();
           
            Document doc = reader.read( args[0] );
           
            XPath xpath = new Dom4jXPath( args[1] );
           
            List results = xpath.selectNodes( doc );

            Iterator resultIter = results.iterator();
           
            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
View Full Code Here

        {
            SAXReader reader = new SAXReader();
           
            Document doc = reader.read( args[0] );
           
            XPath xpath = new Dom4jXPath( args[1] );
           
            List results = xpath.selectNodes( doc );

            Iterator resultIter = results.iterator();
           
            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
View Full Code Here

    public Object evaluate(JellyContext context) {
        this.context = context;

        try
        {
            XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) );

            xpath.setVariableContext(this);

            if (log.isDebugEnabled()) {
                log.debug( "Setting the namespace context to be: " + uris );
            }

            xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );

            return xpath;
        }
        catch (JaxenException e)
        {
View Full Code Here

    public Object evaluate(JellyContext context) {
        this.context = context;

        try
        {
            XPath xpath = new Dom4jXPath( this.xpathExpr.evaluateAsString( context ) );

            xpath.setVariableContext(this);

            if (log.isDebugEnabled()) {
                log.debug( "Setting the namespace context to be: " + uris );
            }

            xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );

            return xpath;
        }
        catch (JaxenException e)
        {
View Full Code Here

        return valueOf(node);
    }

    protected static XPath parse(String text) {
        try {
            return new Dom4jXPath(text);
        } catch (JaxenException e) {
            throw new InvalidXPathException(text, e.getMessage());
        } catch (Throwable t) {
          throw new InvalidXPathException(text, t);
        }
View Full Code Here

                Document doc = recEle.getDocument();
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("pmh", "http://www.openarchives.org/OAI/2.0/");
                map.put("xb", "http://com/exlibris/digitool/repository/api/xmlbeans");

                XPath xpathTitle = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:mds/pmh:md[pmh:type='dc' and pmh:name='descriptive']/pmh:value");
                xpathTitle.setNamespaceContext(new SimpleNamespaceContext(map));

                XPath xpathURL = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:urls/pmh:url[@type='stream']");
                xpathURL.setNamespaceContext(new SimpleNamespaceContext(map));

                XPath xpathLabel = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:control/pmh:label");
                xpathLabel.setNamespaceContext(new SimpleNamespaceContext(map));


                Node dcNode = (Node) xpathTitle.selectSingleNode(doc);
                Node urlNode = (Node) xpathURL.selectSingleNode(doc);
                // Node labelNode = (Node) xpathLabel.selectSingleNode(doc);
View Full Code Here

TOP

Related Classes of org.jaxen.dom4j.Dom4jXPath

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.