Index: build/src/org/jibx/binding/def/ValueChild.java
===================================================================
RCS file: /cvsroot/jibx/core/build/src/org/jibx/binding/def/ValueChild.java,v
retrieving revision 1.7
diff -u -r1.7 ValueChild.java
--- build/src/org/jibx/binding/def/ValueChild.java 25 May 2006 02:51:19 -0000 1.7
+++ build/src/org/jibx/binding/def/ValueChild.java 14 Sep 2007 13:15:29 -0000
@@ -169,6 +169,9 @@
/** Ident type code. */
private final int m_identType;
+
+ /** idref map as */
+ private final String m_idrefMapAs;
/** Attribute or element name information. */
private final NameDefinition m_name;
@@ -204,7 +207,7 @@
*/
public ValueChild(IContainer contain, IContextObj objc, NameDefinition name,
PropertyDefinition prop, StringConversion conv, int style, int ident,
- String constant, boolean nillable) {
+ String idrefMapAs, String constant, boolean nillable) {
m_container = contain;
m_objContext = objc;
m_name = name;
@@ -213,6 +216,7 @@
m_conversion = conv;
m_valueStyle = style;
m_identType = ident;
+ m_idrefMapAs = idrefMapAs;
m_constantValue = constant;
m_isNillable = nillable;
}
@@ -843,7 +847,9 @@
public void setLinkages() throws JiBXException {
if (m_identType == REF_IDENT) {
String type;
- if (m_property == null) {
+ if (m_idrefMapAs != null) {
+ type = m_idrefMapAs;
+ } else if (m_property == null) {
type = m_objContext.getBoundClass().getClassFile().getName();
} else {
type = m_property.getTypeName();
Index: build/src/org/jibx/binding/def/BindingBuilder.java
===================================================================
RCS file: /cvsroot/jibx/core/build/src/org/jibx/binding/def/BindingBuilder.java,v
retrieving revision 1.32
diff -u -r1.32 BindingBuilder.java
--- build/src/org/jibx/binding/def/BindingBuilder.java 18 Dec 2006 10:45:57 -0000 1.32
+++ build/src/org/jibx/binding/def/BindingBuilder.java 14 Sep 2007 13:15:29 -0000
@@ -144,6 +144,7 @@
private static final String VALUE_FORMAT = "format";
private static final String VALUE_CONSTANT = "constant";
private static final String VALUE_IDENT = "ident";
+ private static final String VALUE_IDREFMAPAS = "idref-map-as";
// also name, property, and string groups
/** Definitions for "structure" element use "STRUCTURE" prefix. */
@@ -588,6 +589,9 @@
" not allowed in unordered structure");
}
+ String idrefMapAs = ctx.attributeText(URI_ATTRIBUTES, VALUE_IDREFMAPAS,
+ null);
+
// find the basic converter to use
StringConversion convert = null;
String type = (prop == null || constant != null) ?
@@ -657,7 +661,7 @@
parent.getBindingRoot().setSchemaInstanceUsed();
}
ValueChild value = new ValueChild(parent, cobj, name, prop, convert,
- style, ident, constant, nillable);
+ style, ident, idrefMapAs, constant, nillable);
// handle identifier property flag
if (ident == ValueChild.DEF_IDENT || ident == ValueChild.AUTO_IDENT) {
Index: docs/binding.xsd
===================================================================
RCS file: /cvsroot/jibx/core/docs/binding.xsd,v
retrieving revision 1.5
diff -u -r1.5 binding.xsd
--- docs/binding.xsd 11 Jun 2006 05:24:38 -0000 1.5
+++ docs/binding.xsd 14 Sep 2007 13:15:30 -0000
@@ -1,189 +1,190 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: build/src/org/jibx/binding/model/ValueElement.java
===================================================================
RCS file: /cvsroot/jibx/core/build/src/org/jibx/binding/model/ValueElement.java,v
retrieving revision 1.15
diff -u -r1.15 ValueElement.java
--- build/src/org/jibx/binding/model/ValueElement.java 20 May 2007 22:40:47 -0000 1.15
+++ build/src/org/jibx/binding/model/ValueElement.java 14 Sep 2007 13:15:30 -0000
@@ -46,7 +46,7 @@
/** Enumeration of allowed attribute names */
public static final StringArray s_allowedAttributes =
new StringArray(new String[] { "constant", "format", "ident",
- "nillable", "style" },
+ "idref-map-as", "nillable", "style" },
new StringArray(new StringArray
(NameAttributes.s_allowedAttributes,
PropertyAttributes.s_allowedAttributes),
@@ -85,6 +85,9 @@
/** Supplied identity name. */
private String m_identName = s_identEnum.getName(NONE_IDENT);
+ /** Name of mapping to use as target of idref */
+ private String m_idrefMapAsName;
+
/** Nillable object flag. */
private boolean m_isNillable;