1 19 20 package com.hp.hpl.jena.util.xml; 23 24 25 import java.util.*; 28 29 import org.w3c.dom.*; 30 31 import com.hp.hpl.jena.util.iterator.SingletonIterator; 32 33 34 43 public class SimpleXMLPathDocument 44 implements SimpleXMLPathComponent 45 { 46 47 50 53 56 59 62 66 public Iterator getAll( Node node ) { 67 if (!(node instanceof Document)) { 68 throw new IllegalArgumentException ( "Tried to evaluate a document path expression on a non document: " + node.getClass().getName() ); 69 } 70 71 return new SingletonIterator( ((Document) node).getDocumentElement() ); 72 } 73 74 75 79 public Object getFirst( Node node ) { 80 if (!(node instanceof Document)) { 81 throw new IllegalArgumentException ( "Tried to evaluate a document path expression on a non document: " + node.getClass().getName() ); 82 } 83 84 return ((Document) node).getDocumentElement(); 85 } 86 87 88 91 95 } 96 97 98 124 | Popular Tags |