|
1
|
|
/*
|
|
2
|
|
* JBind
|
|
3
|
|
*
|
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
|
5
|
|
*
|
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
|
8
|
|
* 'Apache Software License V 1.1'.
|
|
9
|
|
*/
|
|
10
|
|
package org.jbind.xml.parser;
|
|
11
|
|
|
|
12
|
|
import java.util.Map;
|
|
13
|
|
|
|
14
|
|
import org.xml.sax.EntityResolver;
|
|
15
|
|
import org.xml.sax.InputSource;
|
|
16
|
|
|
|
17
|
|
public class ParserContext {
|
|
18
|
|
|
|
19
|
|
public final InputSource inputSource;
|
|
20
|
|
public final IContentHandler contentHandler;
|
|
21
|
|
public final IErrorHandler errorHandler;
|
|
22
|
|
public final EntityResolver entityResolver;
|
|
23
|
|
public final INamespaceContext namespaceContext;
|
|
24
|
|
public final Map internalEntities;
|
|
25
|
|
|
|
26
|
|
private final boolean mySignalDocumentEvents;
|
|
27
|
|
|
|
28
|
467
|
public ParserContext(InputSource anInputSource, IContentHandler aContentHandler, IErrorHandler anErrorHandler, EntityResolver anEntityResolver, INamespaceContext aNamespaceContext, Map anInternalEntities, boolean aSignalDocumentEvents) {
|
|
29
|
467
|
inputSource = anInputSource;
|
|
30
|
467
|
contentHandler = aContentHandler;
|
|
31
|
467
|
errorHandler = anErrorHandler;
|
|
32
|
467
|
entityResolver = anEntityResolver;
|
|
33
|
467
|
namespaceContext = aNamespaceContext;
|
|
34
|
467
|
internalEntities = anInternalEntities;
|
|
35
|
467
|
mySignalDocumentEvents = aSignalDocumentEvents;
|
|
36
|
|
}
|
|
37
|
|
|
|
38
|
467
|
public void startDocument() throws Exception {
|
|
39
|
467
|
if (mySignalDocumentEvents) {
|
|
40
|
466
|
contentHandler.startDocument(inputSource, namespaceContext);
|
|
41
|
|
}
|
|
42
|
|
}
|
|
43
|
|
|
|
44
|
467
|
public void endDocument() throws Exception {
|
|
45
|
467
|
if (mySignalDocumentEvents) {
|
|
46
|
466
|
contentHandler.endDocument(inputSource, namespaceContext);
|
|
47
|
|
}
|
|
48
|
|
}
|
|
49
|
|
|
|
50
|
8675
|
public void startElement(QualifiedName aQName, Map anAttributes, int aLine, int aColumn) throws Exception {
|
|
51
|
8675
|
contentHandler.startElement(aQName, anAttributes, aLine, aColumn, inputSource, namespaceContext);
|
|
52
|
|
}
|
|
53
|
|
|
|
54
|
8675
|
public void endElement(QualifiedName aQName, Map anAttributes, int aLine, int aColumn) throws Exception {
|
|
55
|
8675
|
contentHandler.endElement(aQName, anAttributes, aLine, aColumn, inputSource, namespaceContext);
|
|
56
|
|
}
|
|
57
|
|
|
|
58
|
12619
|
public void text(String aString, int aLine, int aColumn) throws Exception {
|
|
59
|
12619
|
contentHandler.text(aString, aLine, aColumn, inputSource, namespaceContext);
|
|
60
|
|
}
|
|
61
|
|
|
|
62
|
|
}
|
|
63
|
|
|