1. /*
  2. * Copyright 2003-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * $Id: EmptySerializer.java,v 1.5 2004/02/17 04:18:19 minchau Exp $
  18. */
  19. package com.sun.org.apache.xml.internal.serializer;
  20. import java.io.IOException;
  21. import java.io.OutputStream;
  22. import java.io.Writer;
  23. import java.util.Hashtable;
  24. import java.util.Properties;
  25. import java.util.Vector;
  26. import javax.xml.transform.SourceLocator;
  27. import javax.xml.transform.Transformer;
  28. import org.w3c.dom.Node;
  29. import org.xml.sax.Attributes;
  30. import org.xml.sax.ContentHandler;
  31. import org.xml.sax.Locator;
  32. import org.xml.sax.SAXException;
  33. import org.xml.sax.SAXParseException;
  34. /**
  35. * This class is an adapter class. Its only purpose is to be extended and
  36. * for that extended class to over-ride all methods that are to be used.
  37. */
  38. public class EmptySerializer implements SerializationHandler
  39. {
  40. protected static final String ERR = "EmptySerializer method not over-ridden";
  41. /**
  42. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#asContentHandler()
  43. */
  44. private static void throwUnimplementedException()
  45. {
  46. /* TODO: throw this exception for real.
  47. * Some users of this class do not over-ride all methods that
  48. * they use, which is a violation of the intended use of this
  49. * class. Those tests used to end in error, but fail when this
  50. * exception is enabled. Perhaps that is an indication of what
  51. * the true problem is. Such tests include copy56,58,59,60 for
  52. * both Xalan-J interpretive and for XSLTC. - bjm
  53. */
  54. // throw new RuntimeException(err);
  55. return;
  56. }
  57. /**
  58. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#asContentHandler()
  59. */
  60. public ContentHandler asContentHandler() throws IOException
  61. {
  62. throwUnimplementedException();
  63. return null;
  64. }
  65. /**
  66. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setContentHandler(org.xml.sax.ContentHandler)
  67. */
  68. public void setContentHandler(ContentHandler ch)
  69. {
  70. throwUnimplementedException();
  71. }
  72. /**
  73. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#close()
  74. */
  75. public void close()
  76. {
  77. throwUnimplementedException();
  78. }
  79. /**
  80. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#getOutputFormat()
  81. */
  82. public Properties getOutputFormat()
  83. {
  84. throwUnimplementedException();
  85. return null;
  86. }
  87. /**
  88. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#getOutputStream()
  89. */
  90. public OutputStream getOutputStream()
  91. {
  92. throwUnimplementedException();
  93. return null;
  94. }
  95. /**
  96. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#getWriter()
  97. */
  98. public Writer getWriter()
  99. {
  100. throwUnimplementedException();
  101. return null;
  102. }
  103. /**
  104. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#reset()
  105. */
  106. public boolean reset()
  107. {
  108. throwUnimplementedException();
  109. return false;
  110. }
  111. /**
  112. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#serialize(org.w3c.dom.Node)
  113. */
  114. public void serialize(Node node) throws IOException
  115. {
  116. throwUnimplementedException();
  117. }
  118. /**
  119. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setCdataSectionElements(java.util.Vector)
  120. */
  121. public void setCdataSectionElements(Vector URI_and_localNames)
  122. {
  123. throwUnimplementedException();
  124. }
  125. /**
  126. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setEscaping(boolean)
  127. */
  128. public boolean setEscaping(boolean escape) throws SAXException
  129. {
  130. throwUnimplementedException();
  131. return false;
  132. }
  133. /**
  134. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setIndent(boolean)
  135. */
  136. public void setIndent(boolean indent)
  137. {
  138. throwUnimplementedException();
  139. }
  140. /**
  141. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setIndentAmount(int)
  142. */
  143. public void setIndentAmount(int spaces)
  144. {
  145. throwUnimplementedException();
  146. }
  147. /**
  148. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setOutputFormat(java.util.Properties)
  149. */
  150. public void setOutputFormat(Properties format)
  151. {
  152. throwUnimplementedException();
  153. }
  154. /**
  155. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setOutputStream(java.io.OutputStream)
  156. */
  157. public void setOutputStream(OutputStream output)
  158. {
  159. throwUnimplementedException();
  160. }
  161. /**
  162. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setVersion(java.lang.String)
  163. */
  164. public void setVersion(String version)
  165. {
  166. throwUnimplementedException();
  167. }
  168. /**
  169. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setWriter(java.io.Writer)
  170. */
  171. public void setWriter(Writer writer)
  172. {
  173. throwUnimplementedException();
  174. }
  175. /**
  176. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setTransformer(javax.xml.transform.Transformer)
  177. */
  178. public void setTransformer(Transformer transformer)
  179. {
  180. throwUnimplementedException();
  181. }
  182. /**
  183. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#getTransformer()
  184. */
  185. public Transformer getTransformer()
  186. {
  187. throwUnimplementedException();
  188. return null;
  189. }
  190. /**
  191. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#flushPending()
  192. */
  193. public void flushPending() throws SAXException
  194. {
  195. throwUnimplementedException();
  196. }
  197. /**
  198. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
  199. */
  200. public void addAttribute(
  201. String uri,
  202. String localName,
  203. String rawName,
  204. String type,
  205. String value)
  206. throws SAXException
  207. {
  208. throwUnimplementedException();
  209. }
  210. /**
  211. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#addAttributes(org.xml.sax.Attributes)
  212. */
  213. public void addAttributes(Attributes atts) throws SAXException
  214. {
  215. throwUnimplementedException();
  216. }
  217. /**
  218. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String)
  219. */
  220. public void addAttribute(String name, String value)
  221. {
  222. throwUnimplementedException();
  223. }
  224. /**
  225. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#characters(java.lang.String)
  226. */
  227. public void characters(String chars) throws SAXException
  228. {
  229. throwUnimplementedException();
  230. }
  231. /**
  232. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#endElement(java.lang.String)
  233. */
  234. public void endElement(String elemName) throws SAXException
  235. {
  236. throwUnimplementedException();
  237. }
  238. /**
  239. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#startDocument()
  240. */
  241. public void startDocument() throws SAXException
  242. {
  243. throwUnimplementedException();
  244. }
  245. /**
  246. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String)
  247. */
  248. public void startElement(String uri, String localName, String qName)
  249. throws SAXException
  250. {
  251. throwUnimplementedException();
  252. }
  253. /**
  254. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#startElement(java.lang.String)
  255. */
  256. public void startElement(String qName) throws SAXException
  257. {
  258. throwUnimplementedException();
  259. }
  260. /**
  261. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#namespaceAfterStartElement(java.lang.String, java.lang.String)
  262. */
  263. public void namespaceAfterStartElement(String uri, String prefix)
  264. throws SAXException
  265. {
  266. throwUnimplementedException();
  267. }
  268. /**
  269. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#startPrefixMapping(java.lang.String, java.lang.String, boolean)
  270. */
  271. public boolean startPrefixMapping(
  272. String prefix,
  273. String uri,
  274. boolean shouldFlush)
  275. throws SAXException
  276. {
  277. throwUnimplementedException();
  278. return false;
  279. }
  280. /**
  281. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#entityReference(java.lang.String)
  282. */
  283. public void entityReference(String entityName) throws SAXException
  284. {
  285. throwUnimplementedException();
  286. }
  287. /**
  288. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#getNamespaceMappings()
  289. */
  290. public NamespaceMappings getNamespaceMappings()
  291. {
  292. throwUnimplementedException();
  293. return null;
  294. }
  295. /**
  296. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#getPrefix(java.lang.String)
  297. */
  298. public String getPrefix(String uri)
  299. {
  300. throwUnimplementedException();
  301. return null;
  302. }
  303. /**
  304. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#getNamespaceURI(java.lang.String, boolean)
  305. */
  306. public String getNamespaceURI(String name, boolean isElement)
  307. {
  308. throwUnimplementedException();
  309. return null;
  310. }
  311. /**
  312. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#getNamespaceURIFromPrefix(java.lang.String)
  313. */
  314. public String getNamespaceURIFromPrefix(String prefix)
  315. {
  316. throwUnimplementedException();
  317. return null;
  318. }
  319. /**
  320. * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
  321. */
  322. public void setDocumentLocator(Locator arg0)
  323. {
  324. throwUnimplementedException();
  325. }
  326. /**
  327. * @see org.xml.sax.ContentHandler#endDocument()
  328. */
  329. public void endDocument() throws SAXException
  330. {
  331. throwUnimplementedException();
  332. }
  333. /**
  334. * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
  335. */
  336. public void startPrefixMapping(String arg0, String arg1)
  337. throws SAXException
  338. {
  339. throwUnimplementedException();
  340. }
  341. /**
  342. * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
  343. */
  344. public void endPrefixMapping(String arg0) throws SAXException
  345. {
  346. throwUnimplementedException();
  347. }
  348. /**
  349. * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
  350. */
  351. public void startElement(
  352. String arg0,
  353. String arg1,
  354. String arg2,
  355. Attributes arg3)
  356. throws SAXException
  357. {
  358. throwUnimplementedException();
  359. }
  360. /**
  361. * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
  362. */
  363. public void endElement(String arg0, String arg1, String arg2)
  364. throws SAXException
  365. {
  366. throwUnimplementedException();
  367. }
  368. /**
  369. * @see org.xml.sax.ContentHandler#characters(char[], int, int)
  370. */
  371. public void characters(char[] arg0, int arg1, int arg2) throws SAXException
  372. {
  373. throwUnimplementedException();
  374. }
  375. /**
  376. * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
  377. */
  378. public void ignorableWhitespace(char[] arg0, int arg1, int arg2)
  379. throws SAXException
  380. {
  381. throwUnimplementedException();
  382. }
  383. /**
  384. * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
  385. */
  386. public void processingInstruction(String arg0, String arg1)
  387. throws SAXException
  388. {
  389. throwUnimplementedException();
  390. }
  391. /**
  392. * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
  393. */
  394. public void skippedEntity(String arg0) throws SAXException
  395. {
  396. throwUnimplementedException();
  397. }
  398. /**
  399. * @see com.sun.org.apache.xml.internal.serializer.ExtendedLexicalHandler#comment(java.lang.String)
  400. */
  401. public void comment(String comment) throws SAXException
  402. {
  403. throwUnimplementedException();
  404. }
  405. /**
  406. * @see org.xml.sax.ext.LexicalHandler#startDTD(java.lang.String, java.lang.String, java.lang.String)
  407. */
  408. public void startDTD(String arg0, String arg1, String arg2)
  409. throws SAXException
  410. {
  411. throwUnimplementedException();
  412. }
  413. /**
  414. * @see org.xml.sax.ext.LexicalHandler#endDTD()
  415. */
  416. public void endDTD() throws SAXException
  417. {
  418. throwUnimplementedException();
  419. }
  420. /**
  421. * @see org.xml.sax.ext.LexicalHandler#startEntity(java.lang.String)
  422. */
  423. public void startEntity(String arg0) throws SAXException
  424. {
  425. throwUnimplementedException();
  426. }
  427. /**
  428. * @see org.xml.sax.ext.LexicalHandler#endEntity(java.lang.String)
  429. */
  430. public void endEntity(String arg0) throws SAXException
  431. {
  432. throwUnimplementedException();
  433. }
  434. /**
  435. * @see org.xml.sax.ext.LexicalHandler#startCDATA()
  436. */
  437. public void startCDATA() throws SAXException
  438. {
  439. throwUnimplementedException();
  440. }
  441. /**
  442. * @see org.xml.sax.ext.LexicalHandler#endCDATA()
  443. */
  444. public void endCDATA() throws SAXException
  445. {
  446. throwUnimplementedException();
  447. }
  448. /**
  449. * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int)
  450. */
  451. public void comment(char[] arg0, int arg1, int arg2) throws SAXException
  452. {
  453. throwUnimplementedException();
  454. }
  455. /**
  456. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getDoctypePublic()
  457. */
  458. public String getDoctypePublic()
  459. {
  460. throwUnimplementedException();
  461. return null;
  462. }
  463. /**
  464. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getDoctypeSystem()
  465. */
  466. public String getDoctypeSystem()
  467. {
  468. throwUnimplementedException();
  469. return null;
  470. }
  471. /**
  472. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getEncoding()
  473. */
  474. public String getEncoding()
  475. {
  476. throwUnimplementedException();
  477. return null;
  478. }
  479. /**
  480. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getIndent()
  481. */
  482. public boolean getIndent()
  483. {
  484. throwUnimplementedException();
  485. return false;
  486. }
  487. /**
  488. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getIndentAmount()
  489. */
  490. public int getIndentAmount()
  491. {
  492. throwUnimplementedException();
  493. return 0;
  494. }
  495. /**
  496. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getMediaType()
  497. */
  498. public String getMediaType()
  499. {
  500. throwUnimplementedException();
  501. return null;
  502. }
  503. /**
  504. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getOmitXMLDeclaration()
  505. */
  506. public boolean getOmitXMLDeclaration()
  507. {
  508. throwUnimplementedException();
  509. return false;
  510. }
  511. /**
  512. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getStandalone()
  513. */
  514. public String getStandalone()
  515. {
  516. throwUnimplementedException();
  517. return null;
  518. }
  519. /**
  520. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#getVersion()
  521. */
  522. public String getVersion()
  523. {
  524. throwUnimplementedException();
  525. return null;
  526. }
  527. /**
  528. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setCdataSectionElements
  529. */
  530. public void setCdataSectionElements(Hashtable h) throws Exception
  531. {
  532. throwUnimplementedException();
  533. }
  534. /**
  535. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setDoctype(java.lang.String, java.lang.String)
  536. */
  537. public void setDoctype(String system, String pub)
  538. {
  539. throwUnimplementedException();
  540. }
  541. /**
  542. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setDoctypePublic(java.lang.String)
  543. */
  544. public void setDoctypePublic(String doctype)
  545. {
  546. throwUnimplementedException();
  547. }
  548. /**
  549. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setDoctypeSystem(java.lang.String)
  550. */
  551. public void setDoctypeSystem(String doctype)
  552. {
  553. throwUnimplementedException();
  554. }
  555. /**
  556. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setEncoding(java.lang.String)
  557. */
  558. public void setEncoding(String encoding)
  559. {
  560. throwUnimplementedException();
  561. }
  562. /**
  563. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setMediaType(java.lang.String)
  564. */
  565. public void setMediaType(String mediatype)
  566. {
  567. throwUnimplementedException();
  568. }
  569. /**
  570. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setOmitXMLDeclaration(boolean)
  571. */
  572. public void setOmitXMLDeclaration(boolean b)
  573. {
  574. throwUnimplementedException();
  575. }
  576. /**
  577. * @see com.sun.org.apache.xml.internal.serializer.XSLOutputAttributes#setStandalone(java.lang.String)
  578. */
  579. public void setStandalone(String standalone)
  580. {
  581. throwUnimplementedException();
  582. }
  583. /**
  584. * @see org.xml.sax.ext.DeclHandler#elementDecl(java.lang.String, java.lang.String)
  585. */
  586. public void elementDecl(String arg0, String arg1) throws SAXException
  587. {
  588. throwUnimplementedException();
  589. }
  590. /**
  591. * @see org.xml.sax.ext.DeclHandler#attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
  592. */
  593. public void attributeDecl(
  594. String arg0,
  595. String arg1,
  596. String arg2,
  597. String arg3,
  598. String arg4)
  599. throws SAXException
  600. {
  601. throwUnimplementedException();
  602. }
  603. /**
  604. * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(java.lang.String, java.lang.String)
  605. */
  606. public void internalEntityDecl(String arg0, String arg1)
  607. throws SAXException
  608. {
  609. throwUnimplementedException();
  610. }
  611. /**
  612. * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
  613. */
  614. public void externalEntityDecl(String arg0, String arg1, String arg2)
  615. throws SAXException
  616. {
  617. throwUnimplementedException();
  618. }
  619. /**
  620. * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
  621. */
  622. public void warning(SAXParseException arg0) throws SAXException
  623. {
  624. throwUnimplementedException();
  625. }
  626. /**
  627. * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
  628. */
  629. public void error(SAXParseException arg0) throws SAXException
  630. {
  631. throwUnimplementedException();
  632. }
  633. /**
  634. * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
  635. */
  636. public void fatalError(SAXParseException arg0) throws SAXException
  637. {
  638. throwUnimplementedException();
  639. }
  640. /**
  641. * @see com.sun.org.apache.xml.internal.serializer.Serializer#asDOMSerializer()
  642. */
  643. public DOMSerializer asDOMSerializer() throws IOException
  644. {
  645. throwUnimplementedException();
  646. return null;
  647. }
  648. /**
  649. * @see com.sun.org.apache.xml.internal.serializer.SerializationHandler#setNamespaceMappings(NamespaceMappings)
  650. */
  651. public void setNamespaceMappings(NamespaceMappings mappings) {
  652. throwUnimplementedException();
  653. }
  654. /**
  655. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#setSourceLocator(javax.xml.transform.SourceLocator)
  656. */
  657. public void setSourceLocator(SourceLocator locator)
  658. {
  659. throwUnimplementedException();
  660. }
  661. /**
  662. * @see com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler#addUniqueAttribute(java.lang.String, java.lang.String, int)
  663. */
  664. public void addUniqueAttribute(String name, String value, int flags)
  665. throws SAXException
  666. {
  667. throwUnimplementedException();
  668. }
  669. }