public static List<RCSBLigand> getFromHeteroAtomIds(InputStream stream) {

		NodeList data;
		try {
			data = ReadUtils.getNodes(stream);
		} catch (IOException e) {
			logger.warn("Couldn't parse XML", e);
			return null;
		}

		List<RCSBLigand> ligands = new ArrayList<RCSBLigand>();

		// first get the ligandInfo
		Element structureIdE = null;
		for (int i = 0; i < data.getLength(); i++) {
			if (data.item(i).getNodeType() != 1) continue;
			structureIdE = (Element) data.item(i);
			if (structureIdE.getNodeName().equals("ligandInfo")) {
				break;
			}
		}

		// now get individual ligands
		data = structureIdE.getChildNodes();
		Element ligandE = null;
		for (int i = 0; i < data.getLength(); i++) {
			if (data.item(i).getNodeType() != 1) continue;
			ligandE = (Element) data.item(i);
			if (ligandE.getNodeName().equals("ligand")) {
				RCSBLigand ligand = makeLigand(ligandE);
				ligands.add(ligand);
			}
		}

		return ligands;

	}
public static List < RCSBLigand > getFromHeteroAtomIds ( InputStream stream ) { NodeList data ; try { data = ReadUtils . getNodes ( stream ) ; } catch ( IOException e ) { logger . warn ( "Couldn't parse XML" , e ) ; return null ; } List < RCSBLigand > ligands = new ArrayList < RCSBLigand > ( ) ; Element structureIdE = null ; for ( int i = 0 ; i < data . getLength ( ) ; i ++ ) { if ( data . item ( i ) . getNodeType ( ) != 1 ) continue ; structureIdE = ( Element ) data . item ( i ) ; if ( structureIdE . getNodeName ( ) . equals ( "ligandInfo" ) ) { break ; } } data = structureIdE . getChildNodes ( ) ; Element ligandE = null ; for ( int i = 0 ; i < data . getLength ( ) ; i ++ ) { if ( data . item ( i ) . getNodeType ( ) != 1 ) continue ; ligandE = ( Element ) data . item ( i ) ; if ( ligandE . getNodeName ( ) . equals ( "ligand" ) ) { RCSBLigand ligand = makeLigand ( ligandE ) ; ligands . add ( ligand ) ; } } return ligands ; }
@return A list of {@link RCSBLigand RCSBLigands} from the XML file loaded as {@code stream}. Prefer calling
{@link #getFromHeteroAtomId(String)} if you want data directly from RCSB's RESTful service.
@see RCSBDescriptionFactory#get(String)