Hi,
thanks for posting the code, I'll look at what can be done at Jettison
level asap when I will be working on the new release
Cheers, Sergey
On 01/07/14 13:19, Lambert, Michael wrote:
If I understood you properly Sergey, you wanted me to paste the generated
class here. I hope this helps!
package com.healthmedia.ws.common.error.v1;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for reasonType complex type.
*
* <p>The following schema fragment specifies the expected content
contained within this class.
*
* <pre>
* <complexType name="reasonType">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute ref="{http://www.w3.org/XML/1998/namespace}lang
use="required""/>
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "reasonType", propOrder = {
"value"
})
public class ReasonType {
@XmlValue
protected String value;
@XmlAttribute(name = "lang", namespace = "
http://www.w3.org/XML/1998/namespace", required = true)
protected String lang;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the lang property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLang() {
return lang;
}
/**
* Sets the value of the lang property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLang(String value) {
this.lang = value;
}
}
On Tue, Jul 1, 2014 at 6:20 AM, Sergey Beryozkin <[email protected]>
wrote:
Hi
On 30/06/14 22:38, Lambert, Michael wrote:
I am extending an xsd string to include xml:language:
<xsd:complexType name="reasonType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<!-- see http://www.ietf.org/rfc/rfc3066.txt for valid values -->
<xsd:attribute ref="xml:lang" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
But when i serialize it out into json i get an ugly '$' as the key to the
string value. Anyway to change it so that the key is printed differently?
"value" would be a better key name for me:
{
"ce1.code": "BadArgument",
"ce1.reason": {
"$": "Bad argument error",
"xml.lang": "en"
}
}
It appears JAXB reports "Bad argument error" as the 'mixed' content.
Jettison marks it with '$'. Can you paste the code generated from the
reasonType type only here ?
By the way, the attributes in XML namespaces do not have to be in a schema
as far as I recall.
Cheers, Sergey
Thanks!
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com