@Override
    public String toXML() {
        StringBuilder xmlData = new StringBuilder();
        String indentionString = gimmeIndentionString();

        if(MarcWorxStringHelper.isNotEmpty(getData())) {
            xmlData.append(indentionString).append("<").append(getName());
            Iterator<TupleContainer<String, String>> iter = getAttributeList().iterator();
            while(iter.hasNext()) {
                TupleContainer<String, String> ssl = iter.next();
                String param = ssl.getLeftSide();
                String value = ssl.getRightSide();
                if(MarcWorxStringHelper.isNotEmpty(value)) {
                    xmlData.append(' ').append(param).append("=\"").append(value)
                        .append("\"");
                }
            }
            xmlData.append(">");
            if(MarcWorxStringHelper.needsCData(getData())) {
                xmlData.append("<![CDATA[").append(getData()).append("]]>");
            } else {
                xmlData.append(getData());
            }
            xmlData.append("</").append(getName()).append(">\r\n");
        } else {
            xmlData.append(buildAttributeLine(indentionString));
            if(MarcWorxStringHelper.isNotEmpty(getData())) {
                xmlData.append(getData());
            }
            xmlData.append(buildParameterLine(indentionString));

            Iterator<XMLBase> iter = getXmlEntries().iterator();
            while(iter.hasNext()) {
                xmlData.append(iter.next().toXML());
            }

            if (!getParameterList().isEmpty() || !getXmlEntries().isEmpty() || MarcWorxStringHelper.isNotEmpty(getData())) {
                xmlData.append(indentionString).append("</").append(getName()).append(">\r\n");
            }
        }
        return xmlData.toString();

    }