1 16 19 package com.sun.org.apache.xpath.internal.objects; 20 21 import com.sun.org.apache.xalan.internal.res.XSLMessages; 22 import com.sun.org.apache.xml.internal.dtm.DTMIterator; 23 import com.sun.org.apache.xml.internal.utils.XMLString; 24 import com.sun.org.apache.xpath.internal.Expression; 25 import com.sun.org.apache.xpath.internal.XPathContext; 26 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; 27 28 31 public class XRTreeFragSelectWrapper extends XRTreeFrag implements Cloneable 32 { 33 XObject m_selected; 34 35 public XRTreeFragSelectWrapper(Expression expr) 36 { 37 super(expr); 38 } 39 40 50 public void fixupVariables(java.util.Vector vars, int globalsSize) 51 { 52 ((Expression)m_obj).fixupVariables(vars, globalsSize); 53 } 54 55 64 public XObject execute(XPathContext xctxt) 65 throws javax.xml.transform.TransformerException 66 { 67 m_selected = ((Expression)m_obj).execute(xctxt); 68 m_selected.allowDetachToRelease(m_allowRelease); 69 if (m_selected.getType() == CLASS_STRING) 70 return m_selected; 71 else 72 return new XString(m_selected.str()); 73 } 74 75 84 public void detach() 85 { 86 if(m_allowRelease) 87 { 88 m_selected.detach(); 89 m_selected = null; 90 } 91 92 super.detach(); 93 } 94 95 100 public double num() 101 throws javax.xml.transform.TransformerException 102 { 103 104 return m_selected.num(); 105 } 106 107 108 113 public XMLString xstr() 114 { 115 return m_selected.xstr(); 116 } 117 118 123 public String str() 124 { 125 return m_selected.str(); 126 } 127 128 133 public int getType() 134 { 135 return CLASS_STRING; 136 } 137 138 143 public int rtf() 144 { 145 throw new RuntimeException (XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); } 147 148 153 public DTMIterator asNodeIterator() 154 { 155 throw new RuntimeException (XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); } 157 158 } 159 | Popular Tags |