<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FXML%2FDOM_Search</id>
		<title>Java/XML/DOM Search - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FXML%2FDOM_Search"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/XML/DOM_Search&amp;action=history"/>
		<updated>2026-04-07T06:11:42Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/XML/DOM_Search&amp;diff=8747&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/XML/DOM_Search&amp;diff=8747&amp;oldid=prev"/>
				<updated>2010-06-01T07:11:26Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 07:11, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java/XML/DOM_Search&amp;diff=8746&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java/XML/DOM_Search&amp;diff=8746&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:47Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Finds and returns the first child element node. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the first child element node. */&lt;br /&gt;
  public static Element getFirstChildElement(Node parent) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getFirstChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              return (Element)child;&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getFirstChildElement(Node):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the first child node with the given name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the first child node with the given name. */&lt;br /&gt;
  public static Element getFirstChildElement(Node parent, String elemNames[]) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getFirstChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  if (child.getNodeName().equals(elemNames[i])) {&lt;br /&gt;
                      return (Element)child;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getFirstChildElement(Node,String[]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the first child node with the given name and attribute name, value pair. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  /**&lt;br /&gt;
   * Finds and returns the first child node with the given name and&lt;br /&gt;
   * attribute name, value pair.&lt;br /&gt;
   */&lt;br /&gt;
  public static Element getFirstChildElement(Node   parent,&lt;br /&gt;
          String elemName,&lt;br /&gt;
          String attrName,&lt;br /&gt;
          String attrValue) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getFirstChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              Element element = (Element)child;&lt;br /&gt;
              if (element.getNodeName().equals(elemName) &amp;amp;&amp;amp;&lt;br /&gt;
                      element.getAttribute(attrName).equals(attrValue)) {&lt;br /&gt;
                  return element;&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getFirstChildElement(Node,String,String,String):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the first child node with the given qualified name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the first child node with the given qualified name. */&lt;br /&gt;
  public static Element getFirstChildElementNS(Node parent,&lt;br /&gt;
          String[][] elemNames) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getFirstChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  String uri = child.getNamespaceURI();&lt;br /&gt;
                  if (uri != null &amp;amp;&amp;amp; uri.equals(elemNames[i][0]) &amp;amp;&amp;amp;&lt;br /&gt;
                          child.getLocalName().equals(elemNames[i][1])) {&lt;br /&gt;
                      return (Element)child;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getFirstChildElementNS(Node,String[][]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the last child element node. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the last child element node. &lt;br /&gt;
   *  Overload previous method for non-Xerces node impl.&lt;br /&gt;
   */&lt;br /&gt;
  public static Element getLastChildElement(Node parent) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getLastChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              return (Element)child;&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getPreviousSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getLastChildElement(Node):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the last child node with the given name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the last child node with the given name. */&lt;br /&gt;
  public static Element getLastChildElement(Node parent, String elemNames[]) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getLastChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  if (child.getNodeName().equals(elemNames[i])) {&lt;br /&gt;
                      return (Element)child;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getPreviousSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getLastChildElement(Node,String[]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the last child node with the given name and attribute name, value pair. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /**&lt;br /&gt;
   * Finds and returns the last child node with the given name and&lt;br /&gt;
   * attribute name, value pair.&lt;br /&gt;
   */&lt;br /&gt;
  public static Element getLastChildElement(Node   parent,&lt;br /&gt;
          String elemName,&lt;br /&gt;
          String attrName,&lt;br /&gt;
          String attrValue) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getLastChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              Element element = (Element)child;&lt;br /&gt;
              if (element.getNodeName().equals(elemName) &amp;amp;&amp;amp;&lt;br /&gt;
                      element.getAttribute(attrName).equals(attrValue)) {&lt;br /&gt;
                  return element;&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getPreviousSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getLastChildElement(Node,String,String,String):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the last child node with the given qualified name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the last child node with the given qualified name. */&lt;br /&gt;
  public static Element getLastChildElementNS(Node parent,&lt;br /&gt;
          String[][] elemNames) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node child = parent.getLastChild();&lt;br /&gt;
      while (child != null) {&lt;br /&gt;
          if (child.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  String uri = child.getNamespaceURI();&lt;br /&gt;
                  if (uri != null &amp;amp;&amp;amp; uri.equals(elemNames[i][0]) &amp;amp;&amp;amp;&lt;br /&gt;
                          child.getLocalName().equals(elemNames[i][1])) {&lt;br /&gt;
                      return (Element)child;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          child = child.getPreviousSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getLastChildElementNS(Node,String[][]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the next sibling element node. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the next sibling element node. */&lt;br /&gt;
  public static Element getNextSiblingElement(Node node) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node sibling = node.getNextSibling();&lt;br /&gt;
      while (sibling != null) {&lt;br /&gt;
          if (sibling.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              return (Element)sibling;&lt;br /&gt;
          }&lt;br /&gt;
          sibling = sibling.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getNextSiblingElement(Node):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the next sibling node with the given name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  &lt;br /&gt;
  /** Finds and returns the next sibling node with the given name. */&lt;br /&gt;
  public static Element getNextSiblingElement(Node node, String elemNames[]) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node sibling = node.getNextSibling();&lt;br /&gt;
      while (sibling != null) {&lt;br /&gt;
          if (sibling.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  if (sibling.getNodeName().equals(elemNames[i])) {&lt;br /&gt;
                      return (Element)sibling;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          sibling = sibling.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getNextSiblingdElement(Node,String[]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the next sibling node with the given name and attribute name, value pair. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  /**&lt;br /&gt;
   * Finds and returns the next sibling node with the given name and&lt;br /&gt;
   * attribute name, value pair. Since only elements have attributes,&lt;br /&gt;
   * the node returned will be of type Node.ELEMENT_NODE.&lt;br /&gt;
   */&lt;br /&gt;
  public static Element getNextSiblingElement(Node   node,&lt;br /&gt;
          String elemName,&lt;br /&gt;
          String attrName,&lt;br /&gt;
          String attrValue) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node sibling = node.getNextSibling();&lt;br /&gt;
      while (sibling != null) {&lt;br /&gt;
          if (sibling.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              Element element = (Element)sibling;&lt;br /&gt;
              if (element.getNodeName().equals(elemName) &amp;amp;&amp;amp;&lt;br /&gt;
                      element.getAttribute(attrName).equals(attrValue)) {&lt;br /&gt;
                  return element;&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          sibling = sibling.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getNextSiblingElement(Node,String,String,String):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Finds and returns the next sibling node with the given qualified name. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
public class Main {&lt;br /&gt;
  /** Finds and returns the next sibling node with the given qualified name. */&lt;br /&gt;
  public static Element getNextSiblingElementNS(Node node,&lt;br /&gt;
          String[][] elemNames) {&lt;br /&gt;
      &lt;br /&gt;
      // search for node&lt;br /&gt;
      Node sibling = node.getNextSibling();&lt;br /&gt;
      while (sibling != null) {&lt;br /&gt;
          if (sibling.getNodeType() == Node.ELEMENT_NODE) {&lt;br /&gt;
              for (int i = 0; i &amp;lt; elemNames.length; i++) {&lt;br /&gt;
                  String uri = sibling.getNamespaceURI();&lt;br /&gt;
                  if (uri != null &amp;amp;&amp;amp; uri.equals(elemNames[i][0]) &amp;amp;&amp;amp;&lt;br /&gt;
                          sibling.getLocalName().equals(elemNames[i][1])) {&lt;br /&gt;
                      return (Element)sibling;&lt;br /&gt;
                  }&lt;br /&gt;
              }&lt;br /&gt;
          }&lt;br /&gt;
          sibling = sibling.getNextSibling();&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      // not found&lt;br /&gt;
      return null;&lt;br /&gt;
      &lt;br /&gt;
  } // getNextSiblingdElementNS(Node,String[][]):Element&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Get parent ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import org.w3c.dom.Element;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static Element getParent(Element elem) {&lt;br /&gt;
      Node parent = elem.getParentNode();&lt;br /&gt;
      if (parent instanceof Element)&lt;br /&gt;
          return (Element)parent;&lt;br /&gt;
      return null;&lt;br /&gt;
  } // getParent(Element):Element&lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>