/** * Parse a MAVLink xml messages descriptor file. * * @param mavlink MAVLink data used and to fill * @param file Parsed file * @param path Path to file * @param target Path for generation * @param inInclude True if we are in an include file * @return implementation code for readers and writers. * @throws ParserConfigurationException * @throws SAXException * @throws IOException */ public Map<String, String> parseFile( MAVLinkData mavlink, String file, String path, String target, boolean inInclude) throws ParserConfigurationException, SAXException, IOException { Map<String, String> implementations = new HashMap<String, String>(); SAXParserFactory fabrique = SAXParserFactory.newInstance(); SAXParser parseur = fabrique.newSAXParser(); if (!inInclude) { mavlink.setFile(file.substring(0, file.indexOf('.'))); System.out.println("MAVLinkData : " + mavlink.getFile()); } else { System.out.println("MAVLinkData INCLUDE : " + file.substring(0, file.indexOf('.'))); } MAVLinkHandler gestionnaire = new MAVLinkHandler(this, mavlink, path, target); parseur.parse(new File(path + File.separator + file), gestionnaire); mavlink = gestionnaire.getMavlink(); generateMessageClass(mavlink, target); mavlink.getEnums().putAll(mavlink.getEnums()); mavlink.getMessages().putAll(mavlink.getMessages()); generateEnumClass(mavlink, target, implementations); return implementations; }