/** * Scan XML for all message definitions and save in map * * @param document for the XML parsing * @param xPath for XPath expression reuse * @param typeByNameMap to use for Type objects * @return {@link java.util.Map} of schemaId to Message * @throws Exception on parsing error. */ public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach((NodeList)xPath.compile(MESSAGE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET), (node) -> addMessageWithIdCheck(distinctNames, messageByIdMap, new Message(node, typeByNameMap), node)); return messageByIdMap; }
/** * Scan XML for all message definitions and save in map * * @param document for the XML parsing * @param xPath for XPath expression reuse * @param typeByNameMap to use for Type objects * @return {@link java.util.Map} of schemaId to Message * @throws Exception on parsing error. */ public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach((NodeList)xPath.compile(MESSAGE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET), (node) -> addMessageWithIdCheck(distinctNames, messageByIdMap, new Message(node, typeByNameMap), node)); return messageByIdMap; }
/** * Scan XML for all message definitions and save in map * * @param document for the XML parsing * @param xPath for XPath expression reuse * @param typeByNameMap to use for Type objects * @return {@link java.util.Map} of schemaId to Message * @throws Exception on parsing error. */ public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach((NodeList)xPath.compile(MESSAGE_XPATH_EXPR).evaluate(document, XPathConstants.NODESET), (node) -> addMessageWithIdCheck(distinctNames, messageByIdMap, new Message(node, typeByNameMap), node)); return messageByIdMap; }