blob: da1b03f5c7d941346913ef757dd40ce557373673 (
plain)
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
|
/*
* Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.serializer.xml;
public class XMLTextNode implements XMLNode {
private String text_;
public XMLTextNode(String text) {
text_ = text != null ? text : "";
text_ = text_.replaceAll("&", "&"); // Should come first
text_ = text_.replaceAll("<", "<");
text_ = text_.replaceAll(">", ">");
}
public String serialize() {
return text_;
}
/**
* Create new object.
*
* @param text Text to create object with, must not be null
*
* @return new object, will never be null
*/
public static XMLTextNode create(String text) {
if (text == null) {
throw new NullPointerException("'text' must not be null");
}
return new XMLTextNode(text);
}
}
|