/** * Makes an XML text representation. * * @param buffer */ public void makeTextElement(PrintWriter buffer) { int size; buffer.print("<authors"); if (id_ != null) { buffer.print(" id=\""); buffer.print(URelaxer.escapeAttrQuot(URelaxer.getString(getId()))); buffer.print("\""); } if (xmlLang_ != null) { buffer.print(" xml:lang=\""); buffer.print(URelaxer.escapeAttrQuot(URelaxer.getString(getXmlLang()))); buffer.print("\""); } buffer.print(">"); size = this.person_.size(); for (int i = 0; i < size; i++) { FtPerson value = (FtPerson) this.person_.get(i); value.makeTextElement(buffer); } buffer.print("</authors>"); }
/** * Tests if a Element <code>element</code> is valid for the <code>FtAuthors</code>. * * @param element * @return boolean */ public static boolean isMatch(Element element) { if (!URelaxer.isTargetElement(element, "authors")) { return (false); } RStack target = new RStack(element); boolean $match$ = false; Element child; if (!FtPerson.isMatchHungry(target)) { return (false); } $match$ = true; while (true) { if (!FtPerson.isMatchHungry(target)) { break; } $match$ = true; } if (!target.isEmptyElement()) { return (false); } return (true); }
/** * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>. * * @param parent */ public void makeElement(Node parent) { Document doc; if (parent instanceof Document) { doc = (Document) parent; } else { doc = parent.getOwnerDocument(); } Element element = doc.createElement("authors"); int size; if (this.id_ != null) { URelaxer.setAttributePropertyByString(element, "id", this.id_); } if (this.xmlLang_ != null) { URelaxer.setAttributePropertyByString(element, "xml:lang", this.xmlLang_); } size = this.person_.size(); for (int i = 0; i < size; i++) { FtPerson value = (FtPerson) this.person_.get(i); value.makeElement(element); } parent.appendChild(element); }
/** @param element */ private void init(Element element) { RStack stack = new RStack(element); id_ = URelaxer.getAttributePropertyAsString(element, "id"); xmlLang_ = URelaxer.getAttributePropertyAsString(element, "xml:lang"); person_.clear(); while (true) { if (FtPerson.isMatch(stack)) { addPerson(new FtPerson(stack)); } else { break; } } }