1 16 19 package org.apache.xalan.templates; 20 21 import javax.xml.transform.TransformerException ; 22 23 import org.apache.xalan.res.XSLTErrorResources; 24 import org.apache.xalan.transformer.TransformerImpl; 25 26 35 public class ElemComment extends ElemTemplateElement 36 { 37 38 44 public int getXSLToken() 45 { 46 return Constants.ELEMNAME_COMMENT; 47 } 48 49 54 public String getNodeName() 55 { 56 return Constants.ELEMNAME_COMMENT_STRING; 57 } 58 59 69 public void execute( 70 TransformerImpl transformer) 71 throws TransformerException 72 { 73 if (TransformerImpl.S_DEBUG) 74 transformer.getTraceManager().fireTraceEvent(this); 75 try 76 { 77 String data = transformer.transformToString(this); 86 87 transformer.getResultTreeHandler().comment(data); 88 } 89 catch(org.xml.sax.SAXException se) 90 { 91 throw new TransformerException (se); 92 } 93 finally 94 { 95 if (TransformerImpl.S_DEBUG) 96 transformer.getTraceManager().fireTraceEndEvent(this); 97 } 98 } 99 100 109 public ElemTemplateElement appendChild(ElemTemplateElement newChild) 110 { 111 112 int type = ((ElemTemplateElement) newChild).getXSLToken(); 113 114 switch (type) 115 { 116 117 case Constants.ELEMNAME_TEXTLITERALRESULT : 119 case Constants.ELEMNAME_APPLY_TEMPLATES : 120 case Constants.ELEMNAME_APPLY_IMPORTS : 121 case Constants.ELEMNAME_CALLTEMPLATE : 122 case Constants.ELEMNAME_FOREACH : 123 case Constants.ELEMNAME_VALUEOF : 124 case Constants.ELEMNAME_COPY_OF : 125 case Constants.ELEMNAME_NUMBER : 126 case Constants.ELEMNAME_CHOOSE : 127 case Constants.ELEMNAME_IF : 128 case Constants.ELEMNAME_TEXT : 129 case Constants.ELEMNAME_COPY : 130 case Constants.ELEMNAME_VARIABLE : 131 case Constants.ELEMNAME_MESSAGE : 132 133 break; 139 default : 140 error(XSLTErrorResources.ER_CANNOT_ADD, 141 new Object []{ newChild.getNodeName(), 142 this.getNodeName() }); 144 } 146 147 return super.appendChild(newChild); 148 } 149 } 150 | Popular Tags |