1 57 58 package com.sun.org.apache.xerces.internal.dom; 59 60 import org.w3c.dom.DocumentFragment ; 61 import org.w3c.dom.Node ; 62 import org.w3c.dom.Text ; 63 64 104 public class DocumentFragmentImpl 105 extends ParentNode 106 implements DocumentFragment { 107 108 112 113 static final long serialVersionUID = -7596449967279236746L; 114 115 119 120 public DocumentFragmentImpl(CoreDocumentImpl ownerDoc) { 121 super(ownerDoc); 122 } 123 124 125 public DocumentFragmentImpl() {} 126 127 131 135 public short getNodeType() { 136 return Node.DOCUMENT_FRAGMENT_NODE; 137 } 138 139 140 public String getNodeName() { 141 return "#document-fragment"; 142 } 143 144 149 public void normalize() { 150 if (isNormalized()) { 152 return; 153 } 154 if (needsSyncChildren()) { 155 synchronizeChildren(); 156 } 157 ChildNode kid, next; 158 159 for (kid = firstChild; kid != null; kid = next) { 160 next = kid.nextSibling; 161 162 if ( kid.getNodeType() == Node.TEXT_NODE ) 168 { 169 if ( next!=null && next.getNodeType() == Node.TEXT_NODE ) 171 { 172 ((Text )kid).appendData(next.getNodeValue()); 173 removeChild( next ); 174 next = kid; } 176 else 177 { 178 if ( kid.getNodeValue().length()==0 ) 180 removeChild( kid ); 181 } 182 } 183 184 kid.normalize(); 185 } 186 187 isNormalized(true); 188 } 189 190 } | Popular Tags |