### Question:
ContentParser { public Map<String, String> parse(ContentParserConfig config, byte[] input) throws XMLParserException, XPathHelperException { Map<String, String> result = new HashMap<String, String>(); OMElement node = XMLParser.bytesToOM(input); String[][] prefixUris = config.toPrefixURIArrays(); String[] prefixes = prefixUris[0]; String[] uris = prefixUris[1]; Map<String, String> expressions = config.getExpressions(); Map<String, String> contentConversions = config.getContentConversions(); for (Map.Entry<String, String> entry : expressions.entrySet()) { String expression = entry.getValue(); String value = parseText(node, expression, prefixes, uris); String variableKey = entry.getKey(); if (contentConversions != null) { String contentConversion = contentConversions.get(variableKey); if (contentConversion != null) { value = ContentConverterUtils.convert(variableKey, value, contentConversion); } } result.put(variableKey, value); } return result; } ContentParser(); Map<String, String> parse(ContentParserConfig config, byte[] input); static final Logger logger; }### Answer:
@Test public void createTemplateVariablesTest() throws Exception { ClassLoader cl = getClass().getClassLoader(); InputStream xmlis = cl.getResourceAsStream(JUnitHelper.SALLY_GRANT); assertNotNull(xmlis); byte[] xml = Io.getBytesFromInputStream(xmlis); assertNotNull(xml); assertTrue(xml.length > 0); ContentParserConfig config = JUnitHelper.createCDAToXDSContentParserConfig(); ContentParser parser = new ContentParser(); Map<String, String> tvars = parser.parse(config, xml); assertNotNull(tvars); assertEquals( "1.2.36.1.2001.1003.0.8003621231167890", tvars.get(ContentVariableName.AuthorInstitutionRoot.toString())); }