All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.processpuzzle.fitnesse.print.html.XmlUtil Maven / Gradle / Ivy

The newest version!
package com.processpuzzle.fitnesse.print.html;

import java.util.AbstractList;
import java.util.Collections;
import java.util.List;
import java.util.RandomAccess;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public final class XmlUtil {
   private XmlUtil() {}

   public static List asList( NodeList n ) {
      return n.getLength() == 0 ? Collections. emptyList() : new NodeListWrapper( n );
   }

   static final class NodeListWrapper extends AbstractList implements RandomAccess {
      private final NodeList list;

      NodeListWrapper( NodeList l ) {
         list = l;
      }

      public Node get( int index ) {
         return list.item( index );
      }

      public int size() {
         return list.getLength();
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy