Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/com/sun/xml/internal/stream/events/ProcessingInstructionEvent.java
86414 views
1
/*
2
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.sun.xml.internal.stream.events ;
27
28
import java.io.Writer;
29
import javax.xml.stream.Location;
30
import javax.xml.stream.XMLStreamConstants;
31
import javax.xml.stream.XMLStreamException;
32
import javax.xml.stream.events.ProcessingInstruction;
33
34
/** Implements Processing Instruction Event
35
*
36
*@author Neeraj Bajaj, Sun Microsystems.
37
*
38
*/
39
40
41
public class ProcessingInstructionEvent extends DummyEvent
42
implements ProcessingInstruction {
43
44
/** Processing Instruction Name */
45
private String fName;
46
/** Processsing instruction content */
47
private String fContent;
48
49
public ProcessingInstructionEvent() {
50
init();
51
}
52
53
public ProcessingInstructionEvent(String targetName, String data) {
54
this(targetName,data,null);
55
}
56
57
public ProcessingInstructionEvent(String targetName, String data,Location loc) {
58
init();
59
this.fName = targetName;
60
fContent = data;
61
setLocation(loc);
62
}
63
64
protected void init() {
65
setEventType(XMLStreamConstants.PROCESSING_INSTRUCTION);
66
}
67
68
public String getTarget() {
69
return fName;
70
}
71
72
public void setTarget(String targetName) {
73
fName = targetName;
74
}
75
76
public void setData(String data) {
77
fContent = data;
78
}
79
80
public String getData() {
81
return fContent;
82
}
83
84
public String toString() {
85
if(fContent != null && fName != null)
86
return "<?" + fName + " " + fContent + "?>";
87
if(fName != null)
88
return "<?" + fName + "?>";
89
if(fContent != null)
90
return "<?" + fContent + "?>";
91
else
92
return "<??>";
93
}
94
95
protected void writeAsEncodedUnicodeEx(java.io.Writer writer)
96
throws java.io.IOException
97
{
98
writer.write(toString());
99
}
100
101
}
102
103