throw new OMHierarchyException(
"DOM doesn't support text nodes as children of a document");
} else {
TextNodeImpl txt;
if (type == OMNode.CDATA_SECTION_NODE) {
txt = new CDATASectionImpl(text, this);
} else {
txt = new TextImpl(text, type, this);
}
((OMContainerEx)parent).addChild(txt, fromBuilder);
return txt;