01: package com.sun.xml.stream.buffer.stax;
02:
03: import com.sun.xml.stream.buffer.AbstractCreator;
04:
05: /**
06: * {@link AbstractCreator} with additional convenience code.
07: *
08: * @author Paul Sandoz
09: * @author Venu
10: * @author Kohsuke Kawaguchi
11: */
12: abstract class StreamBufferCreator extends AbstractCreator {
13: protected void storeQualifiedName(int item, String prefix,
14: String uri, String localName) {
15: if (uri != null && uri.length() > 0) {
16: if (prefix != null && prefix.length() > 0) {
17: item |= FLAG_PREFIX;
18: storeStructureString(prefix);
19: }
20:
21: item |= FLAG_URI;
22: storeStructureString(uri);
23: }
24:
25: storeStructureString(localName);
26:
27: storeStructure(item);
28: }
29:
30: protected final void storeNamespaceAttribute(String prefix,
31: String uri) {
32: int item = T_NAMESPACE_ATTRIBUTE;
33:
34: if (prefix != null && prefix.length() > 0) {
35: item |= FLAG_PREFIX;
36: storeStructureString(prefix);
37: }
38:
39: if (uri != null && uri.length() > 0) {
40: item |= FLAG_URI;
41: storeStructureString(uri);
42: }
43:
44: storeStructure(item);
45: }
46:
47: protected final void storeAttribute(String prefix, String uri,
48: String localName, String type, String value) {
49: storeQualifiedName(T_ATTRIBUTE_LN, prefix, uri, localName);
50:
51: storeStructureString(type);
52: storeContentString(value);
53: }
54:
55: protected final void storeProcessingInstruction(String target,
56: String data) {
57: storeStructure(T_PROCESSING_INSTRUCTION);
58: storeStructureString(target);
59: storeStructureString(data);
60: }
61: }
|