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
|
/*
* Copyright (C) 2001-2013 Michael Fuchs
*
* This file is part of herold.
*
* herold is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* herold is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with herold. If not, see <http://www.gnu.org/licenses/>.
*/
package org.dbdoclet.xiphias.dom;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.DOMException;
import org.w3c.dom.Text;
public class TextImpl extends CharacterDataImpl implements Text {
private static Log logger = LogFactory.getLog(TextImpl.class);
public TextImpl(String text, NodeImpl parent) {
super();
setNodeType(TEXT_NODE);
setNodeName("#text");
setParentNode(parent);
setData(text);
logger.debug("Text text=[" + text + "]");
}
public TextImpl(String text) {
this(text, null);
}
/**
* The method <code>toString</code> returns the first 24 characters of the
* text of this node.
*
* If the length of the text is greater than 24 characters, the text is
* truncated and three digits are appended.
*
* @return a <code>String</code> value
*/
@Override
public String toString() {
String data = getData();
if ((data == null) || (data.length() == 0)) {
return "";
}
if (data.length() < 24) {
return data.trim();
} else {
return data.substring(0, 23) + "...";
}
}
@Override
public String getWholeText() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isElementContentWhitespace() {
// TODO Auto-generated method stub
return false;
}
@Override
public Text replaceWholeText(String content) throws DOMException {
// TODO Auto-generated method stub
return null;
}
@Override
public Text splitText(int offset) throws DOMException {
// TODO Auto-generated method stub
return null;
}
}
|