01: package com.jclark.xml.sax;
02:
03: import com.jclark.xml.parse.*;
04:
05: /**
06: * An special version of the SAX driver that reports comments
07: * as processing instructions with a null target.
08: */
09:
10: public class CommentDriver extends Driver {
11: public void comment(final CommentEvent event)
12: throws org.xml.sax.SAXException {
13: processingInstruction(new ProcessingInstructionEvent() {
14: public ParseLocation getLocation() {
15: return event.getLocation();
16: }
17:
18: public String getName() {
19: return null;
20: }
21:
22: public String getInstruction() {
23: return event.getComment();
24: }
25: });
26: }
27: }
|