- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在通过 ActiveMQ 将对象发送到队列时遇到了问题。我发送的对象是一个 BrokerRequest,它包含一个 UUID、一个优先级 (1,2,3) 和一个作为 JAXB 对象的 DocumentType。
这是我正在使用的代码块:
DocumentType jaxbDoc = getJaxbFromFile("/home/dev/document.xml");
BrokerRequest brokerRequest = new BrokerRequest(UUID.randomUUID(), 1, jaxbDoc);
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = session.createQueue(topic);
MessageProducer producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
ObjectMessage objectMessage = session.createObjectMessage(brokerRequest);
producer.send(objectMessage);
connection.close();
“getJaxbFromFile”方法接收路径,在该路径中我有一个表示此 Jaxb 类型的 xml 文档,我在该方法中所做的是将该 xml 解码为 Jaxb DocumentType 以将其包含在我的 BrokerRequest 对象中。
但是每当我尝试将 objectMessage 发送到代理时,我都会收到 notSerializable 异常,但是 JaxB 中涉及的所有元素都是可序列化的,这就是我不明白为什么会收到此错误的原因。
Exception in thread "main" java.lang.RuntimeException: jaxb.mapped.elements.xsd.commons.MonetaryTotalType
at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:111)
at org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:162)
at org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:381)
at efact.alfa1lab.test.commons.MessageUtils.putMessageOnBroker(MessageUtils.java:184)
at test.commons.MessageUtils.main(MessageUtils.java:97)
Caused by: java.io.NotSerializableException: jaxb.mapped.elements.xsd.commons.MonetaryTotalType
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:105)
如果有人能帮助我,我将不胜感激,如果有人能给我有关此问题的线索,我将不胜感激。
==============================MonetaryType 的代码如下:
import javax.xml.bind.annotation.XmlAccessType;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.AllowanceTotalAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.ChargeTotalAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.LineExtensionAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PayableAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PayableRoundingAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PrepaidAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TaxExclusiveAmountType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TaxInclusiveAmountType;
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>ABIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Details</ccts:DictionaryEntryName><ccts:Definition>Information about Monetary Totals.</ccts:Definition><ccts:ObjectClass>Monetary Total</ccts:ObjectClass>
* </ccts:Component>
* </pre>
*
*
*
* <p>Java class for MonetaryTotalType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MonetaryTotalType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}LineExtensionAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TaxExclusiveAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TaxInclusiveAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}AllowanceTotalAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ChargeTotalAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PrepaidAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PayableRoundingAmount" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PayableAmount"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MonetaryTotalType", propOrder = {
"lineExtensionAmount",
"taxExclusiveAmount",
"taxInclusiveAmount",
"allowanceTotalAmount",
"chargeTotalAmount",
"prepaidAmount",
"payableRoundingAmount",
"payableAmount"
})
public class MonetaryTotalType implements Serializable {
@XmlElement(name = "LineExtensionAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected LineExtensionAmountType lineExtensionAmount;
@XmlElement(name = "TaxExclusiveAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected TaxExclusiveAmountType taxExclusiveAmount;
@XmlElement(name = "TaxInclusiveAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected TaxInclusiveAmountType taxInclusiveAmount;
@XmlElement(name = "AllowanceTotalAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected AllowanceTotalAmountType allowanceTotalAmount;
@XmlElement(name = "ChargeTotalAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected ChargeTotalAmountType chargeTotalAmount;
@XmlElement(name = "PrepaidAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected PrepaidAmountType prepaidAmount;
@XmlElement(name = "PayableRoundingAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected PayableRoundingAmountType payableRoundingAmount;
@XmlElement(name = "PayableAmount", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2", required = true)
protected PayableAmountType payableAmount;
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Line Extension Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total of Line Extension Amounts net of tax and settlement discounts, but inclusive of any applicable rounding amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Line Extension Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link LineExtensionAmountType }
*
*/
public LineExtensionAmountType getLineExtensionAmount() {
return lineExtensionAmount;
}
/**
* Sets the value of the lineExtensionAmount property.
*
* @param value
* allowed object is
* {@link LineExtensionAmountType }
*
*/
public void setLineExtensionAmount(LineExtensionAmountType value) {
this.lineExtensionAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Tax Exclusive Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount exclusive of taxes.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Tax Exclusive Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link TaxExclusiveAmountType }
*
*/
public TaxExclusiveAmountType getTaxExclusiveAmount() {
return taxExclusiveAmount;
}
/**
* Sets the value of the taxExclusiveAmount property.
*
* @param value
* allowed object is
* {@link TaxExclusiveAmountType }
*
*/
public void setTaxExclusiveAmount(TaxExclusiveAmountType value) {
this.taxExclusiveAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Tax Inclusive Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount inclusive of taxes.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Tax Inclusive Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link TaxInclusiveAmountType }
*
*/
public TaxInclusiveAmountType getTaxInclusiveAmount() {
return taxInclusiveAmount;
}
/**
* Sets the value of the taxInclusiveAmount property.
*
* @param value
* allowed object is
* {@link TaxInclusiveAmountType }
*
*/
public void setTaxInclusiveAmount(TaxInclusiveAmountType value) {
this.taxInclusiveAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Allowance Total Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount of all allowances.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Allowance Total Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link AllowanceTotalAmountType }
*
*/
public AllowanceTotalAmountType getAllowanceTotalAmount() {
return allowanceTotalAmount;
}
/**
* Sets the value of the allowanceTotalAmount property.
*
* @param value
* allowed object is
* {@link AllowanceTotalAmountType }
*
*/
public void setAllowanceTotalAmount(AllowanceTotalAmountType value) {
this.allowanceTotalAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Charge Total Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount of all charges.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Charge Total Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link ChargeTotalAmountType }
*
*/
public ChargeTotalAmountType getChargeTotalAmount() {
return chargeTotalAmount;
}
/**
* Sets the value of the chargeTotalAmount property.
*
* @param value
* allowed object is
* {@link ChargeTotalAmountType }
*
*/
public void setChargeTotalAmount(ChargeTotalAmountType value) {
this.chargeTotalAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Prepaid Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total prepaid amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTerm>Prepaid Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link PrepaidAmountType }
*
*/
public PrepaidAmountType getPrepaidAmount() {
return prepaidAmount;
}
/**
* Sets the value of the prepaidAmount property.
*
* @param value
* allowed object is
* {@link PrepaidAmountType }
*
*/
public void setPrepaidAmount(PrepaidAmountType value) {
this.prepaidAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Payable_ Rounding Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The rounding amount (positive or negative) added to the calculated Line Extension Total Amount to produce the rounded Line Extension Total Amount.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTermQualifier>Payable</ccts:PropertyTermQualifier><ccts:PropertyTerm>Rounding Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link PayableRoundingAmountType }
*
*/
public PayableRoundingAmountType getPayableRoundingAmount() {
return payableRoundingAmount;
}
/**
* Sets the value of the payableRoundingAmount property.
*
* @param value
* allowed object is
* {@link PayableRoundingAmountType }
*
*/
public void setPayableRoundingAmount(PayableRoundingAmountType value) {
this.payableRoundingAmount = value;
}
/**
*
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Monetary Total. Payable_ Amount. Amount</ccts:DictionaryEntryName><ccts:Definition>The total amount to be paid.</ccts:Definition><ccts:Cardinality>1</ccts:Cardinality><ccts:ObjectClass>Monetary Total</ccts:ObjectClass><ccts:PropertyTermQualifier>Payable</ccts:PropertyTermQualifier><ccts:PropertyTerm>Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Amount</ccts:RepresentationTerm><ccts:DataType>Amount. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
*
*
* @return
* possible object is
* {@link PayableAmountType }
*
*/
public PayableAmountType getPayableAmount() {
return payableAmount;
}
/**
* Sets the value of the payableAmount property.
*
* @param value
* allowed object is
* {@link PayableAmountType }
*
*/
public void setPayableAmount(PayableAmountType value) {
this.payableAmount = value;
}
}
再次提前致谢。
最佳答案
看起来您正在将 XML 文件解码为自定义类,其中之一是 jaxb.mapped.elements.xsd.commons.MonetaryTotalType
类型。该类不可序列化,导致抛出异常。通常,您应该通过实现 Serializable
接口(interface)将类标记为可序列化。
此外,考虑使用以您的产品或至少公司名称为前缀的包名称;有一个名为 jaxb
的根包会令人困惑,因为它不是您自己的代码。
关于发送包含 JAXB 元素的对象时出现 java.io.NotSerializableException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14267646/
我正在考虑使用 JAXB 进行 XML 解析,但到目前为止我遇到了一些问题,这让我相信它可能不够灵活,无法满足我的需求。 我将解析第三方提供的 XML 以符合我将发布的 XSD。所以我想足够灵活地处理
我正在考虑使用 JAXB 进行 XML 解析,但到目前为止我遇到了一些问题,这让我相信它可能不够灵活,无法满足我的需求。 我将解析第三方提供的 XML 以符合我将发布的 XSD。所以我想足够灵活地处理
我有一个 xsd,用于使用 JAXB 在 Java 中生成对象模型,并且我希望将它生成的列表重命名为 xyzList 而不是 xyz。有没有办法做到这一点,而不必在绑定(bind)文件中为每个列表添加
我们正在使用 JAXB 构建许多开发人员应用程序,并不断遇到问题,这些问题都归结为 JAXB 对象的生产者和消费者之间的“版本”不匹配。 过程并没有减轻痛苦,所以我正在考虑一些类似于 JAXB 的 C
我们有一个在一个属性上带有 JAXB 注释的类。然后我们有几个子类来注释其余的重要数据。然而,我们有一个子类,我们想忽略父类注释,这样它就不会被编码。这是一些示例代码。 父类: @XmlType(na
我一直在使用 Oracle JDK 1.7 附带的默认 Sun JAXB 实现。 不幸的是,我有一些非常复杂的 XSD 模式可以使用,而且我发现了 XSD 到 Java 引擎中的一个错误(在 this
我有这个 Maven“任务”来使用 JAXB 从 XSD 文件生成 Java 类。 com.sun.tools.xjc.maven2
我想要这样的 XML: Foo 我可以通过一个看起来像这样的 JAXB 类成功地做到这一点: @XmlRootElement(name="simple") class Simple { @Xm
我有一个 POJO,我想将其编码并作为 xml 发送,但也想解编从同一个 Web 服务返回的数据。但是,此 POJO 中有某些字段,我不想发送,但可能在服务器返回的 xml 中。 这里的问题是,如果我
嘿伙计们,希望这里是一个简单的好东西。 我正在使用 JAXB 从架构生成类,并且我希望能够使用访问者模式来处理它们。 为此,我认为我需要每个 JAXB 生成的类来实现我定义的接口(interface)
我有一个 POJO,我想将其编码并作为 xml 发送,但也想解编从同一个 Web 服务返回的数据。但是,此 POJO 中有某些字段,我不想发送,但可能在服务器返回的 xml 中。 这里的问题是,如果我
这是我的转换代码。当我们处理大数据时,这需要很长时间......调用该方法几乎一百万次......我们可以清楚地看到它持有线程一段时间。 请建议我一些提高性能的方法! public class Gen
我有一个可以成功编码的 jaxb 对象,它有一个列表对象,然后我创建一个如下所示的新对象 public class Sub extends SuperJAXBClass{ @Override publ
我已经将jaxb库更新为2.0版。 我正在使用以下jars jaxb-api-2.0.jar和jaxb-imp-2.0.jar。 现在的问题是,它没有使用@XmlRootElement(name =“
我在使用 JAXB 时面临以下问题:看起来 JAXB 正在分析从最深的子类到父类的属性,并且子属性具有优先级。我想以某种方式改变这种行为。特别是: 子类: package test.sub; impo
我有以下 XML 消息,我需要反序列化它 我该如何处理? 最佳答案 @XmlElements注释用于映射选择结构。 http://b
我们想用 JAX-RS 和 JAXB 实现一个 RESTful-Web 服务。我们有一个使用 xml 的 PUT 方法,如下所示: -1 test test@gmx.de
我有以下代码 @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class SamplePojo { private S
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 2 年前。
所以我有一个 Jersey 的 REST 服务设置。 我的 POJO 被简单地注释为@XmlRootElement 我向我的 REST 服务发送了一个 POST 请求,一切正常。 1- 我向服务发送了
我是一名优秀的程序员,十分优秀!