//An Element with a Single Block of Text
/*
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE story [
<!ELEMENT story (paragraph)*>
<!ELEMENT paragraph (#PCDATA)>
]>
<story>
<paragraph>Once upon a time</paragraph>
</story>
*/
public void split(Document doc) {
Element root = doc.getDocumentElement();
Element paragraph = (Element)root.getFirstChild();
Text text = (Text)paragraph.getFirstChild();
Text newText = text.splitText(20);
newText.splitText(50);
}
|