/** * This step parses the Prairie metadata files into the Prairie-specific * metadata structure, {@link #meta}. */ private void parsePrairieMetadata() throws FormatException, IOException { LOGGER.info("Parsing Prairie metadata"); final Document xml, cfg, env; try { xml = parseDOM(xmlFile); cfg = parseDOM(cfgFile); env = parseDOM(envFile); } catch (ParserConfigurationException exc) { throw new FormatException(exc); } catch (SAXException exc) { throw new FormatException(exc); } meta = new PrairieMetadata(xml, cfg, env); sequences = meta.getSequences(); channels = meta.getActiveChannels(); if (channels == null || channels.length == 0) { throw new FormatException("No active channels found"); } }
/** * This step parses the Prairie metadata files into the Prairie-specific * metadata structure, {@link #meta}. */ private void parsePrairieMetadata() throws FormatException, IOException { LOGGER.info("Parsing Prairie metadata"); final Document xml, cfg, env; try { xml = parseDOM(xmlFile); cfg = parseDOM(cfgFile); env = parseDOM(envFile); } catch (ParserConfigurationException exc) { throw new FormatException(exc); } catch (SAXException exc) { throw new FormatException(exc); } meta = new PrairieMetadata(xml, cfg, env); sequences = meta.getSequences(); channels = meta.getActiveChannels(); if (channels == null || channels.length == 0) { throw new FormatException("No active channels found"); } }
@Test public void testParseOldXML() throws ParserConfigurationException, SAXException, IOException { final Document xml = XMLTools.parseDOM(OLD_XML); final PrairieMetadata meta = new PrairieMetadata(xml, null, null); final Value positionCurrent = meta.getSequence(1).getFrame(1).getValue("positionCurrent"); final Value xAxis = positionCurrent.get("XAxis"); assertEquals("0.95", xAxis.value()); final Value yAxis = positionCurrent.get("YAxis"); assertEquals("-4.45", yAxis.value()); final ValueTable zAxis = (ValueTable) positionCurrent.get("ZAxis"); assertEquals("-9", zAxis.get(0).value()); assertEquals("62.45", zAxis.get(1).value()); }
@Test public void testParseNewXML() throws ParserConfigurationException, SAXException, IOException { final Document xml = XMLTools.parseDOM(NEW_XML); final PrairieMetadata meta = new PrairieMetadata(xml, null, null); final ValueTable positionCurrent = (ValueTable) meta.getSequence(1).getFrame(1).getValue("positionCurrent"); final ValueTable xAxis = (ValueTable) positionCurrent.get("XAxis"); assertEquals("-621.412879412341", xAxis.value()); final ValueTable yAxis = (ValueTable) positionCurrent.get("YAxis"); assertEquals("255.652372573538", yAxis.value()); final ValueTable zAxis = (ValueTable) positionCurrent.get("ZAxis"); assertEquals("28.15", zAxis.get(0).value()); assertEquals("111.23", zAxis.get(1).value()); } }