Package org.jostraca.tree

Examples of org.jostraca.tree.Node


public class ParentStep extends Step {

  @Override
  public void perform(Node pNode) {
    Node p = pNode.getParent();
    mNext.perform(p);
  }
View Full Code Here


 
  public String value(Node node) {
    String value = "";
    List<Node> nodes = mStepPath.select(node);
    if( 0 < nodes.size() ) {
      Node n = nodes.get(0);
      String attr     = mStepPath.getAttribute();
      String attrtype = mStepPath.getAttributeType();
      if( null != attr ) {
        value = n.getAttr( attr, attrtype );
      }
      else {
        value = n.getText();
      }
    }
    return value;
  }
View Full Code Here

    return new Path( pPathStr ).toString();
  }
 
 
  public void testSelect() throws Exception {
    Node n = parse("<r><foo><bar/><bar/></foo></r>");
    StepPath sp = new StepPath();
    sp.add( new ChildStep("foo") );
    sp.add( new ChildStep("bar") );
    assertEquals( "[bar, bar, ]", NodeTest.toString(sp.select(n)));
View Full Code Here

    assertEquals( "[qaz, qaz, ]", NodeTest.toString(sp.select(n)));
  }
 
 
  public void testPredicate() throws Exception {
    Node n = parse("<r><foo><bar/><bar/></foo></r>");
    assertEquals( "[bar, bar, ]", NodeTest.toString(p("foo/bar[true()]").select(n)));
    assertEquals( "[]", NodeTest.toString(p("foo/bar[false()]").select(n)));
    assertEquals( "[bar, bar, ]", NodeTest.toString(p("foo/bar[1=1.0]").select(n)));
    assertEquals( "[]", NodeTest.toString(p("foo/bar[1=2]").select(n)));
  }
View Full Code Here

    assertEquals( "[]", NodeTest.toString(p("foo/bar[1=2]").select(n)));
  }
 
 
  public void testNamespace() throws Exception {
    Node n = parse("<r xmlns:q='http://www.example.com/q'>"
        +"<foo><q:bar/><q:bar/></foo></r>", "http://www.example.com/q", "q");
    System.out.println(n);
    assertEquals( "[q: bar, q: bar, ]", NodeTest.toString(p("foo/q:bar[true()]").select(n),true));
    assertEquals( "[]", NodeTest.toString(p("foo/q:bar[false()]").select(n),true));
    assertEquals( "[q: bar, q: bar, ]", NodeTest.toString(p("foo/q:bar[1=1.0]").select(n),true));
View Full Code Here

   
    for( int nsI = 0; nsI < pNS.length; nsI+=2) {
      xnp.addNamespaceType(pNS[nsI], pNS[nsI+1]);
    }
   
    Node root = xnp.parse(is, "test");
    return root;
  }
View Full Code Here

TOP

Related Classes of org.jostraca.tree.Node

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.