1 50 51 package org.openlaszlo.iv.flash.xml.caucho; 52 53 54 import org.openlaszlo.iv.flash.xml.*; 55 import org.openlaszlo.iv.flash.context.*; 56 import org.openlaszlo.iv.flash.util.*; 57 58 import java.util.*; 59 60 import javax.xml.transform.TransformerException ; 61 62 import org.w3c.dom.*; 63 import org.w3c.dom.traversal.NodeIterator; 64 65 import com.caucho.xpath.*; 66 67 74 75 public class XMLContextImpl extends XMLContext { 76 77 83 84 public XMLContextImpl( Context parent, Node node ) { 85 super(parent, node); 86 } 87 88 95 public String getValue( String path ) { 96 98 try { 100 String value = XPath.evalString(path, node); 101 102 if( value != null && value.length() > 0 ) { 103 return value; 104 } 105 } catch( com.caucho.xpath.XPathException e ) { 106 } catch( Exception e ) { 109 Log.logRB(e); 110 } 111 112 return getValueFromParent( path ); 113 } 114 115 123 public List getValueList( String path ) { 124 125 try { 126 Iterator it = XPath.select(path, node); 127 if( it != null ) { 128 ArrayList list = new ArrayList(); 129 while( it.hasNext() ) { 130 Node n = (Node) it.next(); 131 list.add(new XMLContextImpl(this, n)); 132 } 133 134 return list; 135 } 136 } catch( com.caucho.xpath.XPathException e ) { 137 } 138 139 143 return getValueListFromParent( path ); 144 } 145 146 } 147 148 | Popular Tags |