File: XMLWriter.java

package info (click to toggle)
lib-xp-java 0.5-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,652 kB
  • ctags: 2,424
  • sloc: java: 8,085; makefile: 53; sh: 17; xml: 7
file content (123 lines) | stat: -rw-r--r-- 4,275 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.jclark.xml.output;

import java.io.Writer;
import java.io.IOException;

/**
 * An extension of <code>Writer</code> for writing XML documents.
 * The normal <code>write</code> methods write character data,
 * automatically escaping markup characters.
 * @version $Revision: 1.4 $ $Date: 1998/06/16 13:24:37 $
 */

public abstract class XMLWriter extends Writer {

  protected XMLWriter(Object lock) {
    super(lock);
  }

  /**
   * Starts an element.
   * This may be followed by zero or more calls to <code>attribute</code>.
   * The start-tag will be closed by the first following call to any method
   * other than <code>attribute</code>.
   */
  public abstract void startElement(String name) throws IOException;

  /**
   * Writes an attribute.
   * This is not legal if there have been calls to methods other than
   * <code>attribute</code> since the last call to <code>startElement</code>,
   * unless inside a <code>startAttribute</code>, <code>endAttribute</code>
   * pair.
   */
  public abstract void attribute(String name, String value) throws IOException;

  /**
   * Starts an attribute.
   * This writes the attribute name, <code>=</code> and the opening
   * quote.
   * This provides an alternative to <code>attribute</code>
   * that allows markup to be included in the attribute value.
   * The value of the attribute is written using the normal
   * <code>write</code> methods;
   * <code>endAttribute</code> must be called at the end
   * of the attribute value.
   * Entity and character references can be written using
   * <code>entityReference</code> and <code>characterReference</code>.
   */
  public abstract void startAttribute(String name) throws IOException;

  /**
   * Ends an attribute.
   * This writes the closing quote of the attribute value.
   */
  public abstract void endAttribute() throws IOException;

  /**
   * Ends an element.
   * This may output an end-tag or close the current start-tag as an
   * empty element.
   */
  public abstract void endElement(String name) throws IOException;

  /**
   * Writes a processing instruction.
   * If <code>data</code> is non-empty a space will be inserted automatically
   * to separate it from the <code>target</code>.
   */
  public abstract void processingInstruction(String target, String data) throws IOException;

  /**
   * Writes a comment.
   */
  public abstract void comment(String body) throws IOException;

  /**
   * Writes an entity reference.
   */
  public abstract void entityReference(boolean isParam, String name) throws IOException;

  /**
   * Writes a character reference.
   */
  public abstract void characterReference(int n) throws IOException;

  /**
   * Writes a CDATA section.
   */
  public abstract void cdataSection(String content) throws IOException;

  /**
   * Starts the replacement text for an internal entity.
   * The replacement text must be ended with
   * <code>endReplacementText</code>.
   * This enables an extra level of escaping that protects
   * against the process of constructing an entity's replacement
   * text from the literal entity value.
   * See Section 4.5 of the XML Recommendation.
   * Between a call to <code>startReplacementText</code>
   * and <code>endReplacementText</code>, the argument to
   * <code>markup</code> would specify entity replacement text;
   * these would be escaped so that when processed as
   * a literal entity value, the specified entity replacement text
   * would be constructed.
   * This call does not itself cause anything to be written.
   */
  public abstract void startReplacementText() throws IOException;

  /**
   * Ends the replacement text for an internal entity.
   * This disables the extra level of escaping enabled by
   * <code>startReplacementText</code>.
   * This call does not itself cause anything to be written.
   */
  public abstract void endReplacementText() throws IOException;

  /**
   * Writes markup.  The characters in the string will be written as is
   * without being escaped (except for any escaping enabled by
   * <code>startReplacementText</code>).
   */
  public abstract void markup(String str) throws IOException;
}