use of eu.transkribus.core.model.beans.customtags.PersonTag in project TranskribusCore by Transkribus.
the class TrpTeiStringBuilder method createTagStart.
String createTagStart(CustomTag t) {
String ts = "";
if (t instanceof TextStyleTag) {
// TODO!!
TextStyleTag tst = (TextStyleTag) t;
ts = "<hi rend='" + tst.getAttributeCssStr() + "'>";
} else if (t instanceof AbbrevTag) {
AbbrevTag at = (AbbrevTag) t;
ts = "<choice><expan>" + StringEscapeUtils.escapeXml(at.getExpansion()) + "</expan><abbr>";
} else if (t instanceof PersonTag) {
PersonTag pt = (PersonTag) t;
ts = "<persName>";
if (!StringUtils.isEmpty(pt.getFirstname())) {
ts += "<forename>" + StringEscapeUtils.escapeXml(pt.getFirstname()) + "</forename>";
}
if (!StringUtils.isEmpty(pt.getLastname())) {
ts += "<surname>" + StringEscapeUtils.escapeXml(pt.getLastname()) + "</surname>";
}
if (!StringUtils.isEmpty(pt.getDateOfBirth())) {
ts += "<birth>" + StringEscapeUtils.escapeXml(pt.getDateOfBirth()) + "</birth>";
}
if (!StringUtils.isEmpty(pt.getDateOfBirth())) {
ts += "<death>" + StringEscapeUtils.escapeXml(pt.getDateOfDeath()) + "</death>";
}
if (!StringUtils.isEmpty(pt.getNotice())) {
ts += "<notice>" + StringEscapeUtils.escapeXml(pt.getNotice()) + "</notice>";
}
} else if (t instanceof PlaceTag) {
PlaceTag pt = (PlaceTag) t;
ts = "<placeName>";
if (!StringUtils.isEmpty(pt.getCountry())) {
ts += "<country>" + StringEscapeUtils.escapeXml(pt.getCountry()) + "</country>";
}
} else if (t instanceof OrganizationTag) {
OrganizationTag ot = (OrganizationTag) t;
ts = "<orgName>";
} else if (t instanceof SpeechTag) {
SpeechTag st = (SpeechTag) t;
ts = "<sp>";
if (!StringUtils.isEmpty(st.getSpeaker())) {
ts += "<speaker>" + StringEscapeUtils.escapeXml(st.getSpeaker()) + "</speaker>";
}
} else if (t instanceof GapTag) {
ts = "<gap />";
} else // do nothing because comment tag is added at the end of the tag entry as note in the createTagEnd method
if (t instanceof CommentTag) {
ts = "";
} else {
// general tag
ts = "<" + t.getTagName();
for (String an : t.getAttributeNames()) {
if (CustomTag.isOffsetOrLengthOrContinuedProperty(an))
continue;
Object v = t.getAttributeValue(an);
if (v != null) {
ts += " " + StringEscapeUtils.escapeXml(an) + "='" + StringEscapeUtils.escapeXml(v.toString()) + "'";
}
}
ts += ">";
}
return ts;
}
Aggregations