问题
How to get all the tags of basic data types [of xsd data types (like xs:byte, xs:date, xs:dateTime, xs:decimal, xs:double, xs:duration etc.) or iso20022 types (like iso20022:Amount, iso20022:Binary, iso20022:Date, iso20022:DateTime etc.)] of from e-repository.xml?
回答1:
Download from https://www.iso20022.org/message_archive.page XSD schema of the message (Pain.001, Camt.053 etc.) you want to implement and with the help of Eclipse, Java and JAXB you can get all data models in the form of Java classes.
EDIT:
Examples of generated datamodels:
Camt.053 - AmountAndCurrencyExchangeDetails4
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AmountAndCurrencyExchangeDetails4", propOrder = {
"tp",
"amt",
"ccyXchg"
})
public class AmountAndCurrencyExchangeDetails4 {
@XmlElement(name = "Tp", required = true)
protected String tp;
@XmlElement(name = "Amt", required = true)
protected ActiveOrHistoricCurrencyAndAmount amt;
@XmlElement(name = "CcyXchg")
protected CurrencyExchange5 ccyXchg;
public String getTp() {
return tp;
}
public void setTp(String value) {
this.tp = value;
}
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
public CurrencyExchange5 getCcyXchg() {
return ccyXchg;
}
public void setCcyXchg(CurrencyExchange5 value) {
this.ccyXchg = value;
}
}
Pain.001 - DateAndPlaceOfBirth
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DateAndPlaceOfBirth", propOrder = {
"birthDt",
"prvcOfBirth",
"cityOfBirth",
"ctryOfBirth"
})
public class DateAndPlaceOfBirth {
@XmlElement(name = "BirthDt", required = true)
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar birthDt;
@XmlElement(name = "PrvcOfBirth")
protected String prvcOfBirth;
@XmlElement(name = "CityOfBirth", required = true)
protected String cityOfBirth;
@XmlElement(name = "CtryOfBirth", required = true)
protected String ctryOfBirth;
public XMLGregorianCalendar getBirthDt() {
return birthDt;
}
public void setBirthDt(XMLGregorianCalendar value) {
this.birthDt = value;
}
public String getPrvcOfBirth() {
return prvcOfBirth;
}
public void setPrvcOfBirth(String value) {
this.prvcOfBirth = value;
}
public String getCityOfBirth() {
return cityOfBirth;
}
public void setCityOfBirth(String value) {
this.cityOfBirth = value;
}
public String getCtryOfBirth() {
return ctryOfBirth;
}
public void setCtryOfBirth(String value) {
this.ctryOfBirth = value;
}
}
回答2:
You might be interested on the open source model and parser For ISO 20022 messages by Prowide.
It includes a comprehensive dictionary model for all ISO 20022 message types.
The key feature is that it is not a default jaxb generation from the XSDs, but a customised model where the dictionary classes are not namespace aware. Thus they can be shared across message types. The Mx model classes then provide working parser and builder using these shared dictionary of classes.
if you have to process many different ISO 20022 message types this makes a huge difference.
Link to the project: https://github.com/prowide/prowide-iso20022
I'm one of the authors.
来源:https://stackoverflow.com/questions/37562395/how-to-get-all-the-tags-of-basic-data-types-from-e-repository-of-iso20022