private void registerResource(XFormsElement element, XFormsElement parent) {
   element.setResourceId(resourceId.toString());
   parentRelationships.put(element, parent);
   resourceId++;
 }
 public List<String> getResourceIds() {
   List<String> resourceIds = new ArrayList<String>();
   for (XFormsElement e : this.getRegisteredElements()) resourceIds.add(e.getResourceId());
   return resourceIds;
 }
  private void appendElementERDF(Writer writer, XFormsElement element) throws IOException {
    writer.append("<div id=\"" + element.getResourceId() + "\">");
    appendOryxField(writer, "type", STENCILSET_URI + "#" + element.getStencilId());

    for (String field : element.getAttributes().keySet()) {
      if (!field.equals("bind"))
        appendXFormsField(writer, field, element.getAttributes().get(field));
    }

    // handle PCData containers
    if (element instanceof PCDataContainer) {
      String content = ((PCDataContainer) element).getContent();
      if (element instanceof Label) {
        appendXFormsField(writer, "text", content);
      } else {
        appendXFormsField(writer, "message", content);
      }
    }

    // handle model item properties
    String ref = element.getAttributes().get("ref");
    if (ref != null) {

      if (!ref.startsWith("/") && (element instanceof XFormsUIElement)) {
        ref = getNodesetContext((XFormsUIElement) element) + ref;
      }

      Bind bind = getBindByNodeset(ref);

      if (bind != null) {
        for (String field : bind.getAttributes().keySet()) {
          if (!field.equals("id") && !field.equals("nodeset"))
            appendXFormsField(writer, field, bind.getAttributes().get(field));
        }
      }
    }

    // handle submission properties
    String submissionId = element.getAttributes().get("submission");
    if (submissionId != null) {
      Submission submission = getSubmissionById(submissionId);
      if (submission != null) {
        for (String field : submission.getAttributes().keySet()) {
          if (!field.equals("id"))
            appendXFormsField(writer, field, submission.getAttributes().get(field));
        }
      }
    }

    // handle item element
    if (element instanceof Item) {
      Item item = (Item) element;
      Value value = item.getValue();
      if (value != null) {
        for (String field : value.getAttributes().keySet()) {
          if (!field.equals("id"))
            appendXFormsField(writer, "value_" + field, value.getAttributes().get(field));
        }
      }
      appendOryxField(writer, "bounds", "0," + item.getYPosition() + ",0," + item.getYPosition());
    }

    // handle itemset element
    if (element instanceof Itemset) {
      Itemset itemset = (Itemset) element;
      Value value = itemset.getValue();
      if (value != null) {
        for (String field : value.getAttributes().keySet()) {
          appendXFormsField(writer, "value_" + field, value.getAttributes().get(field));
        }
      }
      Copy copy = ((Itemset) element).getCopy();
      if (copy != null) {
        for (String field : copy.getAttributes().keySet()) {
          appendXFormsField(writer, "copy_" + field, copy.getAttributes().get(field));
        }
      }
      appendOryxField(
          writer, "bounds", "0," + itemset.getYPosition() + ",0," + itemset.getYPosition());
    }

    if (element instanceof XFormsUIElement) {
      int x = ((XFormsUIElement) element).getXPosition();
      int y = (((XFormsUIElement) element).getYPosition() + 10) * DISTANCE_FACTOR;
      appendOryxField(writer, "bounds", x + "," + y + "," + x + "," + y);
    }

    writer.append(
        "<a rel=\"raziel-parent\" href=\"#" + context.getParent(element).getResourceId() + "\"/>");
    writer.append("</div>");
  }