Exemplo n.º 1
0
  public void endElement(String name) throws SAXException {
    if (isDebug) emit("end element" + eol); // NOT LOCALIZABLE

    if (!elementStack.empty()) {
      String removed = (String) elementStack.pop();

      if (name.equals(kTaggedValue)) {
        taggedValueMode = false;
      }

      // is the element removed a concept (as table, column, etc.)?
      int removedSrxId = XmiMapping.getSrxId(removed);
      if (removedSrxId != XmiMapping.UNKNOWN) {
        // does this concept have an identifier?
        String xmiName = XmiMapping.getXmiName(removedSrxId);
        if (!xmiName.equals("")) {
          if (!occurrenceNameStack.empty()) {
            occurrenceNameStack.pop(); // yes, so pop its name
          }
        }
      } // end if
    } // end if
  } // end endElement()
Exemplo n.º 2
0
  private void emitNewOccurrence(int srxId, AttributeList attrs) throws SAXException {

    enabledOutput = toProcess(srxId);
    if (!enabledOutput) {
      return;
    }

    currentSrxId = srxId;
    String mappedName = XmiMapping.getMappingName(srxId);
    emit(eol + kOccurrenceType + " " + mappedName + eol);

    // if it's a component, write its composite
    String composite = XmiMapping.getComposite(srxId);
    if (composite != null) {
      if (!occurrenceNameStack.empty()) {
        String compositeName = (String) occurrenceNameStack.peek();
        if (compositeName != null) {
          emit(composite + " " + compositeName + eol);
        }
      } // end if
    } // end if

    // Keep its XMI.id
    if (attrs != null) {
      for (int i = 0; i < attrs.getLength(); i++) {
        String attr = attrs.getName(i);
        if (attr.equals(kXmiId)) {
          currentXmiId = attrs.getValue(i);
        } // end if
      } // end for
    } // end if

    // Keep its current XMI name & SRX name
    currentXmiName = XmiMapping.getXmiName(srxId);
    currentSrxName = XmiMapping.getSrxName(srxId);
  }