code: public static Map<String, String> getMacs(Document domainXml) {
          Map<String, String> macs = new HashMap<>();
          XPathFactory xpf = XPathFactory.instance();
          XPathExpression<Element> interfaces = xpf.compile("/domain/devices/interface", Filters.element());
          for (Element iface : interfaces.evaluate(domainXml)) {
              String interfaceType = iface.getAttribute("type").getValue();
              logger.debug("Detecting IP on network of type '{}'", interfaceType);
              if ("bridge".equals(interfaceType)) {
                  Element macElement = iface.getChild("mac");
                  String mac = macElement.getAttribute("address").getValue();
                  Element sourceElement = iface.getChild("source");
                  String bridge = sourceElement.getAttribute("bridge").getValue();
                  logger.info("Detected MAC '{}' on bridge '{}'", mac, bridge);
                  macs.put(bridge, mac);
              } else if ("network".equals(interfaceType)) {
                  Element macElement = iface.getChild("mac");
                  String mac = macElement.getAttribute("address").getValue();
                  Element sourceElement = iface.getChild("source");
                  String network = sourceElement.getAttribute("network").getValue();
                  logger.info("Detected MAC '{}' on network '{}'", mac, network);
                  macs.put(network, mac);
              } else {
                  logger.warn("Ignoring network of type {}", interfaceType);
              }
          }
          return macs;
      }
docs: Get a map of mac addresses of interfaces defined on the domain. This is somewhat limited at the moment. It is
  assumed that only one network interface with mac is connected to a bridge or network. For instance if you have a
  bridged network device connected to 'br0' then you will find it's MAC address with the key 'br0'.