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.*; 32 import com.hp.hpl.jena.util.iterator.ExtendedIterator; 33 34 35 45 public class SimpleXMLPath 46 { 47 50 53 56 57 protected List m_path = new ArrayList(); 58 59 62 66 public SimpleXMLPath() { 67 this( false ); 68 } 69 70 71 79 public SimpleXMLPath( boolean documentRoot ) { 80 if (documentRoot) { 81 appendDocumentPath(); 82 } 83 } 84 85 86 89 95 public SimpleXMLPath append( SimpleXMLPathComponent path ) { 96 m_path.add( path ); 97 return this; 98 } 99 100 101 106 public SimpleXMLPath appendDocumentPath() { 107 return append( new SimpleXMLPathDocument() ); 108 } 109 110 111 117 public SimpleXMLPath appendElementPath( String elemName ) { 118 return append( new SimpleXMLPathElement( elemName ) ); 119 } 120 121 122 128 public SimpleXMLPath appendAttrPath( String attrName ) { 129 return append( new SimpleXMLPathAttr( attrName ) ); 130 } 131 132 136 public List getPathComponents() { 137 return m_path; 138 } 139 140 141 146 public SimpleXMLPathComponent getPathComponent( int i ) { 147 return (SimpleXMLPathComponent) m_path.get( i ); 148 } 149 150 151 160 public ExtendedIterator getAll( Document doc ) { 161 return WrappedIterator.create( new SimpleXMLPathIterator( this, doc ) ); 162 } 163 164 165 174 public ExtendedIterator getAll( Element elem ) { 175 return WrappedIterator.create( new SimpleXMLPathIterator( this, elem ) ); 176 } 177 178 179 182 186 } 187 188 189 215 | Popular Tags |