code: public void fromXml(String xml) {
          try {
              XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xml.getBytes()));
              String attr = null;
              String chars = null;
              Map<Object, Object> res = new HashMap<>();
              while (reader.hasNext()) {
                  int event = reader.next();
                  switch (event) {
                      case XMLStreamConstants.START_ELEMENT:
                          attr = reader.getLocalName();
                          break;
                      case XMLStreamConstants.CHARACTERS:
                          chars = reader.getText().trim();;
                          break;
                      case XMLStreamConstants.END_ELEMENT:
                          if (attr != null && !blank(chars)) {
                              res.put(attr, chars);
                          }
                          attr = chars = null;
                          break;
                  }
              }
              fromMap(res);
          } catch (XMLStreamException e) {
              throw new InitException(e);
          }
      }
docs: Parses XML into a model. It expects the same structure of XML as the method {@link #toXml(int, boolean, String...)}.
  It ignores children and dependencies (for now) if any. This method  will parse the model attributes
  from the XML document, and will then call {@link #fromMap(java.util.Map)} method. It does not save data into a database, just sets the
  attributes.
  
  @param xml xml to read model attributes from.