コード例 #1
0
ファイル: XML.java プロジェクト: JakubValtar/processing
 /**
  * Returns an array containing all the child elements.
  *
  * @webref xml:method
  * @brief Returns an array containing all child elements
  */
 public XML[] getChildren() {
   //    NodeList children = node.getChildNodes();
   //    int childCount = children.getLength();
   //    XMLElement[] kids = new XMLElement[childCount];
   //    for (int i = 0; i < childCount; i++) {
   //      Node kid = children.item(i);
   //      kids[i] = new XMLElement(this, kid);
   //    }
   //    return kids;
   checkChildren();
   return children;
 }
コード例 #2
0
ファイル: XML.java プロジェクト: JakubValtar/processing
 /**
  * Put the names of all children into an array. Same as looping through each child and calling
  * getName() on each XMLElement.
  *
  * @webref xml:method
  * @brief Returns the names of all children as an array
  */
 public String[] listChildren() {
   //    NodeList children = node.getChildNodes();
   //    int childCount = children.getLength();
   //    String[] outgoing = new String[childCount];
   //    for (int i = 0; i < childCount; i++) {
   //      Node kid = children.item(i);
   //      if (kid.getNodeType() == Node.ELEMENT_NODE) {
   //        outgoing[i] = kid.getNodeName();
   //      } // otherwise just leave him null
   //    }
   checkChildren();
   String[] outgoing = new String[children.length];
   for (int i = 0; i < children.length; i++) {
     outgoing[i] = children[i].getName();
   }
   return outgoing;
 }
コード例 #3
0
ファイル: XML.java プロジェクト: JakubValtar/processing
 /**
  * Quick accessor for an element at a particular index.
  *
  * @webref xml:method
  * @brief Returns the child element with the specified index value or path
  */
 public XML getChild(int index) {
   checkChildren();
   return children[index];
 }
コード例 #4
0
ファイル: XML.java プロジェクト: JakubValtar/processing
 /**
  * Returns a boolean of whether or not there are children.
  *
  * @webref xml:method
  * @brief Checks whether or not an element has any children
  */
 public boolean hasChildren() {
   checkChildren();
   return children.length > 0;
 }
コード例 #5
0
ファイル: XML.java プロジェクト: JakubValtar/processing
 /**
  * Returns the number of children.
  *
  * @webref xml:method
  * @brief Returns the element's number of children
  * @return the count.
  */
 public int getChildCount() {
   checkChildren();
   return children.length;
 }