从unmarshalled对象类中获取元素名称

时间:2015-02-12 09:36:07

标签: xml parsing xml-parsing jaxb

解组我的xml后,我得到了一个像这样的课程

public static class OrderDetails {

        @XmlElement(name = "InitiatorRole", required = true)
        protected String initiatorRole;
        @XmlElement(name = "OriginatorId", required = true)
        protected String originatorId;
        public String getInitiatorRole() {
            return initiatorRole;
        }
        public void setInitiatorRole(String value) {
            this.initiatorRole = value;
        }
        public String getOriginatorId() {
            return originatorId;
        }
        public void setOriginatorId(String value) {
            this.originatorId = value;
        }
     }

现在我想从这个类中打印xmlelement名称 InitiatorRole ORIGINATORID 该怎么做..?

0 个答案:

没有答案