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.xml.internal.utils.XMLString; 23 import com.sun.org.apache.xpath.internal.XPathContext; 24 import com.sun.org.apache.xpath.internal.objects.XObject; 25 import com.sun.org.apache.xpath.internal.objects.XString; 26 import org.xml.sax.ContentHandler ; 27 28 32 public class FuncNormalizeSpace extends FunctionDef1Arg 33 { 34 35 43 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 44 { 45 XMLString s1 = getArg0AsString(xctxt); 46 47 return (XString)s1.fixWhiteSpace(true, true, false); 48 } 49 50 62 public void executeCharsToContentHandler(XPathContext xctxt, 63 ContentHandler handler) 64 throws javax.xml.transform.TransformerException , 65 org.xml.sax.SAXException 66 { 67 if(Arg0IsNodesetExpr()) 68 { 69 int node = getArg0AsNode(xctxt); 70 if(DTM.NULL != node) 71 { 72 DTM dtm = xctxt.getDTM(node); 73 dtm.dispatchCharactersEvents(node, handler, true); 74 } 75 } 76 else 77 { 78 XObject obj = execute(xctxt); 79 obj.dispatchCharactersEvents(handler); 80 } 81 } 82 83 } 84 | Popular Tags |