/* */ public void insertChild(XMLElement child, int index) /* */ { /* 422 */ if (child == null) { /* 423 */ throw new IllegalArgumentException("child must not be null"); /* */ } /* 425 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) { /* 426 */ XMLElement lastChild = (XMLElement)this.children.lastElement(); /* 427 */ if (lastChild.getLocalName() == null) { /* 428 */ lastChild.setContent(lastChild.getContent() + /* 429 */ child.getContent()); /* 430 */ return; /* */ } /* */ } /* 433 */ child.parent = this; /* 434 */ this.children.insertElementAt(child, index); /* */ }
/* */ public void addChild(XMLElement child) /* */ { /* 398 */ if (child == null) { /* 399 */ throw new IllegalArgumentException("child must not be null"); /* */ } /* 401 */ if ((child.getLocalName() == null) && (!this.children.isEmpty())) { /* 402 */ XMLElement lastChild = (XMLElement)this.children.lastElement(); /* */ /* 404 */ if (lastChild.getLocalName() == null) { /* 405 */ lastChild.setContent(lastChild.getContent() + /* 406 */ child.getContent()); /* 407 */ return; /* */ } /* */ } /* 410 */ child.parent = this; /* 411 */ this.children.addElement(child); /* */ }
/* */ public boolean equals(Object object) /* */ { /* 1350 */ if (!(object instanceof XMLElement)) { /* 1351 */ return false; /* */ } /* 1353 */ XMLElement rawElement = (XMLElement)object; /* */ /* 1355 */ if (!this.name.equals(rawElement.getLocalName())) { /* 1356 */ return false; /* */ } /* 1358 */ if (this.attributes.size() != rawElement.getAttributeCount()) { /* 1359 */ return false; /* */ } /* 1361 */ Enumeration<XMLAttribute> en = this.attributes.elements(); /* 1362 */ while (en.hasMoreElements()) { /* 1363 */ XMLAttribute attr = (XMLAttribute)en.nextElement(); /* */ /* 1365 */ if (!rawElement.hasAttribute(attr.getName())) { /* 1366 */ return false; /* */ } /* */ /* */ /* */ /* 1371 */ String value = rawElement.getString(attr.getName(), null); /* 1372 */ if (!attr.getValue().equals(value)) { /* 1373 */ return false; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* 1381 */ if (this.children.size() != rawElement.getChildCount()) { /* 1382 */ return false; /* */ } /* 1384 */ for (int i = 0; i < this.children.size(); i++) { /* 1385 */ XMLElement child1 = getChild(i); /* 1386 */ XMLElement child2 = rawElement.getChild(i); /* */ /* 1388 */ if (!child1.equals(child2)) { /* 1389 */ return false; /* */ } /* */ } /* 1392 */ return true; /* */ }