Revision 31
Added by Matt Jones over 24 years ago
DBSAXHandler.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import oracle.xml.parser.v2.SAXParser; |
24 | 24 |
|
25 |
/** |
|
26 |
* A database aware Class implementing callback bethods for the SAX parser to |
|
27 |
* call when processing the XML stream and generating events |
|
28 |
*/ |
|
25 | 29 |
public class DBSAXHandler extends DefaultXMLDocumentHandler |
26 | 30 |
{ |
27 | 31 |
|
... | ... | |
30 | 34 |
private Stack elementStack; |
31 | 35 |
private Connection conn = null; |
32 | 36 |
|
37 |
/** Construct an instance of the handler class |
|
38 |
* |
|
39 |
* @param conn the JDBC connection to which information is written |
|
40 |
*/ |
|
33 | 41 |
public DBSAXHandler(Connection conn) |
34 | 42 |
{ |
35 | 43 |
this.conn = conn; |
... | ... | |
43 | 51 |
|
44 | 52 |
} |
45 | 53 |
|
54 |
/** SAX Handler that is called at the start of each XML element */ |
|
46 | 55 |
public void startElement(NSName name, SAXAttrList atts) throws SAXException |
47 | 56 |
{ |
48 | 57 |
|
... | ... | |
102 | 111 |
|
103 | 112 |
} |
104 | 113 |
|
114 |
/** SAX Handler that is called for each XML text node */ |
|
105 | 115 |
public void characters(char[] cbuf, int start, int len) |
106 | 116 |
{ |
107 | 117 |
DBSAXElement currentElement = (DBSAXElement)elementStack.peek(); |
108 | 118 |
currentElement.appendContent(cbuf,start,len); |
109 | 119 |
} |
110 | 120 |
|
121 |
/** |
|
122 |
* SAX Handler that is called for each XML text node that is Ignorable |
|
123 |
* white space |
|
124 |
*/ |
|
111 | 125 |
public void ignorableWhitespace(char[] cbuf, int start, int len) |
112 | 126 |
{ |
113 | 127 |
} |
114 | 128 |
|
129 |
/** SAX Handler that is called at the end of each XML element */ |
|
115 | 130 |
public void endElement(NSName name) throws SAXException |
116 | 131 |
{ |
117 | 132 |
// Use the methods getQualifiedName(), getLocalName(), getNamespace() |
Also available in: Unified diff
documentation additions