1 16 19 package com.sun.org.apache.xpath.internal.functions; 20 21 import com.sun.org.apache.xml.internal.dtm.DTM; 22 import com.sun.org.apache.xpath.internal.XPathContext; 23 import com.sun.org.apache.xpath.internal.objects.XObject; 24 import com.sun.org.apache.xpath.internal.objects.XString; 25 26 31 public class FuncDoclocation extends FunctionDef1Arg 32 { 33 34 42 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 43 { 44 45 int whereNode = getArg0AsNode(xctxt); 46 String fileLocation = null; 47 48 if (DTM.NULL != whereNode) 49 { 50 DTM dtm = xctxt.getDTM(whereNode); 51 52 if (DTM.DOCUMENT_FRAGMENT_NODE == dtm.getNodeType(whereNode)) 54 { 55 whereNode = dtm.getFirstChild(whereNode); 56 } 57 58 if (DTM.NULL != whereNode) 59 { 60 fileLocation = dtm.getDocumentBaseURI(); 61 } 64 } 65 66 return new XString((null != fileLocation) ? fileLocation : ""); 67 } 68 } 69 | Popular Tags |