本文整理匯總了Java中org.w3c.dom.CharacterData.appendData方法的典型用法代碼示例。如果您正苦於以下問題:Java CharacterData.appendData方法的具體用法?Java CharacterData.appendData怎麽用?Java CharacterData.appendData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.w3c.dom.CharacterData
的用法示例。
在下文中一共展示了CharacterData.appendData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAppendData
import org.w3c.dom.CharacterData; //導入方法依賴的package包/類
@Test
public void testAppendData() throws Exception {
CharacterData cd = createCharacterData("DOM");
cd.appendData("2");
assertEquals(cd.getData(), "DOM2");
}
示例2: characters
import org.w3c.dom.CharacterData; //導入方法依賴的package包/類
public void characters (char ch [], int start, int length)
throws SAXException
{
// we can't create populated entity ref nodes using
// only public DOM APIs (they've got to be readonly
// at creation time)
if (currentEntity != null)
return;
Node lastChild = top.getLastChild ();
// merge consecutive text or CDATA nodes if appropriate.
if (lastChild instanceof Text) {
if (consumer.isHidingCDATA ()
// consecutive Text content ... always merge
|| (!inCDATA
&& !(lastChild instanceof CDATASection))
// consecutive CDATASection content ... don't
// merge between sections, only within them
|| (inCDATA && mergeCDATA
&& lastChild instanceof CDATASection)
) {
CharacterData last = (CharacterData) lastChild;
String value = new String (ch, start, length);
last.appendData (value);
return;
}
}
if (inCDATA && !consumer.isHidingCDATA ()) {
top.appendChild (createText (true, ch, start, length));
mergeCDATA = true;
} else
top.appendChild (createText (false, ch, start, length));
}
示例3: characters
import org.w3c.dom.CharacterData; //導入方法依賴的package包/類
public void characters (char ch [], int start, int length)
throws SAXException
{
// we can't create populated entity ref nodes using
// only public DOM APIs (they've got to be readonly
// at creation time)
if (currentEntity != null)
return;
Node lastChild = top.getLastChild ();
// merge consecutive text or CDATA nodes if appropriate.
if (lastChild instanceof Text) {
if (consumer.isHidingCDATA ()
// consecutive Text content ... always merge
|| (!inCDATA
&& !(lastChild instanceof CDATASection))
// consecutive CDATASection content ... don't
// merge between sections, only within them
|| (inCDATA && mergeCDATA
&& lastChild instanceof CDATASection)
) {
CharacterData last = (CharacterData) lastChild;
String value = new String (ch, start, length);
last.appendData (value);
return;
}
}
if (inCDATA && !consumer.isHidingCDATA ()) {
top.appendChild (createText (true, ch, start, length));
mergeCDATA = true;
} else
top.appendChild (createText (false, ch, start, length));
}