/**
  * @param s
  * @param parent
  */
 private void process(SimpleComponent s, MessageElement parent) {
   Location loc = s.location();
   Req req = s.req();
   MessageElementData data =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           s.position(),
           s.instance(),
           null,
           SUB_COMPONENT);
   MessageElement el = new MessageElement(NODE_SUB_COMPONENT, data, parent);
   MessageElementData value =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           s.position(),
           s.instance(),
           s.value().raw(),
           SUB_COMPONENT);
   new MessageElement("value", value, el);
 }
  /**
   * @param f : field
   * @param parent : parent
   */
  private void process(Field f, MessageElement parent) {
    Location loc = f.location();
    Req req = f.req();
    Range card = Util.getOption(req.cardinality());
    String rep = f.toString();
    MessageElementData data =
        new MessageElementData(
            loc.uidPath(),
            loc.desc(),
            req.usage().toString(),
            card.min(),
            card.max(),
            loc.line(),
            loc.column(),
            -1,
            f.position(),
            f.instance(),
            null,
            FIELD);

    MessageElement el = new MessageElement(NODE_FIELD, data, parent);
    if (f instanceof SimpleField) {
      SimpleField s = (SimpleField) f;
      MessageElementData value =
          new MessageElementData(
              loc.uidPath(),
              loc.desc(),
              req.usage().toString(),
              card.min(),
              card.max(),
              loc.line(),
              loc.column(),
              -1,
              f.position(),
              f.instance(),
              s.value().raw(),
              FIELD);
      new MessageElement("value", value, el);
    } else {
      ComplexField c = (ComplexField) f;
      List<Component> children = c.children();
      if (children != null && !children.isEmpty()) {
        Iterator<Component> it = children.iterator();
        while (it.hasNext()) {
          process(it.next(), el);
        }
      }
    }
  }
  /**
   * @param e
   * @param parentName
   * @param parent
   */
  private void process(SegOrGroup e, String parentName, MessageElement parent) {
    if (e == null) {
      return;
    }
    if (e instanceof Segment) {
      Segment s = (Segment) e;
      Location loc = s.location();
      Req req = s.req();
      Range card = Util.getOption(req.cardinality());
      MessageElementData data =
          new MessageElementData(
              loc.uidPath(),
              loc.desc(),
              req.usage().toString(),
              card.min(),
              card.max(),
              loc.line(),
              loc.column(),
              -1,
              s.position(),
              s.instance(),
              null,
              SEGMENT);
      MessageElement el = new MessageElement(NODE_SEGMENT, data, parent);
      List<Field> children = s.children();
      if (children != null && !children.isEmpty()) {
        Iterator<Field> it = children.iterator();
        while (it.hasNext()) {
          process(it.next(), el);
        }
      }

    } else if (e instanceof Group) {
      Group g = (Group) e;
      List<SegOrGroup> children = g.children();
      if (children != null && !children.isEmpty()) {
        scala.collection.Iterator<SegOrGroup> it = children.iterator();
        while (it.hasNext()) {
          process(it.next(), "", parent);
        }
      }
    }
  }
 /**
  * @param c
  * @param parent
  */
 private void process(Component c, MessageElement parent) {
   Location loc = c.location();
   Req req = c.req();
   MessageElementData data =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           c.position(),
           c.instance(),
           null,
           COMPONENT);
   MessageElement el = new MessageElement(NODE_COMPONENT, data, parent);
   if (c instanceof SimpleComponent) {
     SimpleComponent s = (SimpleComponent) c;
     MessageElementData value =
         new MessageElementData(
             loc.uidPath(),
             loc.desc(),
             req.usage().toString(),
             -1,
             null,
             loc.line(),
             loc.column(),
             -1,
             s.position(),
             c.instance(),
             s.value().raw(),
             COMPONENT);
     new MessageElement("value", value, el);
   } else {
     ComplexComponent cc = (ComplexComponent) c;
     List<SimpleComponent> children = cc.children();
     if (children != null && !children.isEmpty()) {
       Iterator<SimpleComponent> it = children.iterator();
       while (it.hasNext()) {
         process(it.next(), el);
       }
     }
   }
 }