Exemple #1
0
 /**
  * Tests if a Element <code>element</code> is valid for the <code>FtHeader</code>.
  *
  * @param element
  * @return boolean
  */
 public static boolean isMatch(Element element) {
   if (!URelaxer.isTargetElement(element, "header")) {
     return (false);
   }
   RStack target = new RStack(element);
   boolean $match$ = false;
   Element child;
   if (!FtTitle.isMatchHungry(target)) {
     return (false);
   }
   $match$ = true;
   if (FtSubtitle.isMatchHungry(target)) {}
   if (FtVersion.isMatchHungry(target)) {}
   if (FtType.isMatchHungry(target)) {}
   if (FtAuthors.isMatchHungry(target)) {}
   while (true) {
     if (!FtNotice.isMatchHungry(target)) {
       break;
     }
     $match$ = true;
   }
   if (FtAbstract.isMatchHungry(target)) {}
   if (!target.isEmptyElement()) {
     return (false);
   }
   return (true);
 }
Exemple #2
0
 /** @param element */
 private void init(Element element) {
   RStack stack = new RStack(element);
   id_ = URelaxer.getAttributePropertyAsString(element, "id");
   xmlLang_ = URelaxer.getAttributePropertyAsString(element, "xml:lang");
   setTitle(new FtTitle(stack));
   if (FtSubtitle.isMatch(stack)) {
     setSubtitle(new FtSubtitle(stack));
   }
   if (FtVersion.isMatch(stack)) {
     setVersion(new FtVersion(stack));
   }
   if (FtType.isMatch(stack)) {
     setType(new FtType(stack));
   }
   if (FtAuthors.isMatch(stack)) {
     setAuthors(new FtAuthors(stack));
   }
   notice_.clear();
   while (true) {
     if (FtNotice.isMatch(stack)) {
       addNotice(new FtNotice(stack));
     } else {
       break;
     }
   }
   if (FtAbstract.isMatch(stack)) {
     setAbstract(new FtAbstract(stack));
   }
 }
Exemple #3
0
 /**
  * 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("header");
   int size;
   if (this.id_ != null) {
     URelaxer.setAttributePropertyByString(element, "id", this.id_);
   }
   if (this.xmlLang_ != null) {
     URelaxer.setAttributePropertyByString(element, "xml:lang", this.xmlLang_);
   }
   this.title_.makeElement(element);
   if (this.subtitle_ != null) {
     this.subtitle_.makeElement(element);
   }
   if (this.version_ != null) {
     this.version_.makeElement(element);
   }
   if (this.type_ != null) {
     this.type_.makeElement(element);
   }
   if (this.authors_ != null) {
     this.authors_.makeElement(element);
   }
   size = this.notice_.size();
   for (int i = 0; i < size; i++) {
     FtNotice value = (FtNotice) this.notice_.get(i);
     value.makeElement(element);
   }
   if (this.abstract_ != null) {
     this.abstract_.makeElement(element);
   }
   parent.appendChild(element);
 }
Exemple #4
0
 /**
  * Makes an XML text representation.
  *
  * @param buffer
  */
 public void makeTextElement(PrintWriter buffer) {
   int size;
   buffer.print("<header");
   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(">");
   title_.makeTextElement(buffer);
   if (subtitle_ != null) {
     subtitle_.makeTextElement(buffer);
   }
   if (version_ != null) {
     version_.makeTextElement(buffer);
   }
   if (type_ != null) {
     type_.makeTextElement(buffer);
   }
   if (authors_ != null) {
     authors_.makeTextElement(buffer);
   }
   size = this.notice_.size();
   for (int i = 0; i < size; i++) {
     FtNotice value = (FtNotice) this.notice_.get(i);
     value.makeTextElement(buffer);
   }
   if (abstract_ != null) {
     abstract_.makeTextElement(buffer);
   }
   buffer.print("</header>");
 }