Java Code Examples for com.sun.xml.internal.bind.v2.runtime.XMLSerializer#writeXsiNilTrue()

The following examples show how to use com.sun.xml.internal.bind.v2.runtime.XMLSerializer#writeXsiNilTrue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayERProperty.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ListT list = acc.get(o);

    if(list!=null) {
        if(wrapperTagName!=null) {
            w.startElement(wrapperTagName,null);
            w.endNamespaceDecls(list);
            w.endAttributes();
        }

        serializeListBody(o,w,list);

        if(wrapperTagName!=null)
            w.endElement();
    } else {
        // list is null
        if(isWrapperNillable) {
            w.startElement(wrapperTagName,null);
            w.writeXsiNilTrue();
            w.endElement();
        } // otherwise don't print the wrapper tag name
    }
}
 
Example 2
Source File: ArrayERProperty.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ListT list = acc.get(o);

    if(list!=null) {
        if(wrapperTagName!=null) {
            w.startElement(wrapperTagName,null);
            w.endNamespaceDecls(list);
            w.endAttributes();
        }

        serializeListBody(o,w,list);

        if(wrapperTagName!=null)
            w.endElement();
    } else {
        // list is null
        if(isWrapperNillable) {
            w.startElement(wrapperTagName,null);
            w.writeXsiNilTrue();
            w.endElement();
        } // otherwise don't print the wrapper tag name
    }
}
 
Example 3
Source File: ArrayERProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ListT list = acc.get(o);

    if(list!=null) {
        if(wrapperTagName!=null) {
            w.startElement(wrapperTagName,null);
            w.endNamespaceDecls(list);
            w.endAttributes();
        }

        serializeListBody(o,w,list);

        if(wrapperTagName!=null)
            w.endElement();
    } else {
        // list is null
        if(isWrapperNillable) {
            w.startElement(wrapperTagName,null);
            w.writeXsiNilTrue();
            w.endElement();
        } // otherwise don't print the wrapper tag name
    }
}
 
Example 4
Source File: SingleMapNodeProperty.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if(v!=null) {
        bareStartTag(w,tagName,v);
        for( Map.Entry e : (Set<Map.Entry>)v.entrySet() ) {
            bareStartTag(w,entryTag,null);

            Object key = e.getKey();
            if(key!=null) {
                w.startElement(keyTag,key);
                w.childAsXsiType(key,fieldName,keyBeanInfo, false);
                w.endElement();
            }

            Object value = e.getValue();
            if(value!=null) {
                w.startElement(valueTag,value);
                w.childAsXsiType(value,fieldName,valueBeanInfo, false);
                w.endElement();
            }

            w.endElement();
        }
        w.endElement();
    } else
    if(nillable) {
        w.startElement(tagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 5
Source File: ArrayElementNodeProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void serializeItem(JaxBeanInfo expected, ItemT item, XMLSerializer w) throws SAXException, IOException, XMLStreamException {
    if(item==null) {
        w.writeXsiNilTrue();
    } else {
        w.childAsXsiType(item,fieldName,expected, false);
    }
}
 
Example 6
Source File: SingleElementNodeProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if (v!=null) {
        Class vtype = v.getClass();
        TagAndType tt=typeNames.get(vtype); // quick way that usually works

        if(tt==null) {// slow way that always works
            for (Map.Entry<Class,TagAndType> e : typeNames.entrySet()) {
                if(e.getKey().isAssignableFrom(vtype)) {
                    tt = e.getValue();
                    break;
                }
            }
        }

        boolean addNilDecl = (o instanceof JAXBElement) && ((JAXBElement)o).isNil();
        if(tt==null) {
            // actually this is an error, because the actual type was not a sub-type
            // of any of the types specified in the annotations,
            // but for the purpose of experimenting with simple type substitution,
            // it's convenient to marshal this anyway (for example so that classes
            // generated from simple types like String can be marshalled as expected.)
            w.startElement(typeNames.values().iterator().next().tagName,null);
            w.childAsXsiType(v,fieldName,w.grammar.getBeanInfo(Object.class), addNilDecl && nillable);
        } else {
            w.startElement(tt.tagName,null);
            w.childAsXsiType(v,fieldName,tt.beanInfo, addNilDecl && nillable);
        }
        w.endElement();
    } else if (nillable) {
        w.startElement(nullTagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 7
Source File: SingleElementLeafProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    boolean hasValue = xacc.hasValue(o);

    Object obj = null;

    try {
        obj = acc.getUnadapted(o);
    } catch (AccessorException ae) {
        ; // noop
    }

    Class valueType = acc.getValueType();

    // check for different type than expected. If found, add xsi:type declaration
    if (xsiTypeNeeded(o, w, obj, valueType)) {
        w.startElement(tagName, outerPeer);
        w.childAsXsiType(obj, fieldName, w.grammar.getBeanInfo(valueType), false);
        w.endElement();
    } else {  // current type is expected
        if (hasValue) {
            xacc.writeLeafElement(w, tagName, o, fieldName);
        } else if (nillable) {
            w.startElement(tagName, null);
            w.writeXsiNilTrue();
            w.endElement();
        }
    }
}
 
Example 8
Source File: SingleElementLeafProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    boolean hasValue = xacc.hasValue(o);

    Object obj = null;

    try {
        obj = acc.getUnadapted(o);
    } catch (AccessorException ae) {
        ; // noop
    }

    Class valueType = acc.getValueType();

    // check for different type than expected. If found, add xsi:type declaration
    if (xsiTypeNeeded(o, w, obj, valueType)) {
        w.startElement(tagName, outerPeer);
        w.childAsXsiType(obj, fieldName, w.grammar.getBeanInfo(valueType), false);
        w.endElement();
    } else {  // current type is expected
        if (hasValue) {
            xacc.writeLeafElement(w, tagName, o, fieldName);
        } else if (nillable) {
            w.startElement(tagName, null);
            w.writeXsiNilTrue();
            w.endElement();
        }
    }
}
 
Example 9
Source File: SingleElementNodeProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if (v!=null) {
        Class vtype = v.getClass();
        TagAndType tt=typeNames.get(vtype); // quick way that usually works

        if(tt==null) {// slow way that always works
            for (Map.Entry<Class,TagAndType> e : typeNames.entrySet()) {
                if(e.getKey().isAssignableFrom(vtype)) {
                    tt = e.getValue();
                    break;
                }
            }
        }

        boolean addNilDecl = (o instanceof JAXBElement) && ((JAXBElement)o).isNil();
        if(tt==null) {
            // actually this is an error, because the actual type was not a sub-type
            // of any of the types specified in the annotations,
            // but for the purpose of experimenting with simple type substitution,
            // it's convenient to marshal this anyway (for example so that classes
            // generated from simple types like String can be marshalled as expected.)
            w.startElement(typeNames.values().iterator().next().tagName,null);
            w.childAsXsiType(v,fieldName,w.grammar.getBeanInfo(Object.class), addNilDecl && nillable);
        } else {
            w.startElement(tt.tagName,null);
            w.childAsXsiType(v,fieldName,tt.beanInfo, addNilDecl && nillable);
        }
        w.endElement();
    } else if (nillable) {
        w.startElement(nullTagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 10
Source File: ArrayElementNodeProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void serializeItem(JaxBeanInfo expected, ItemT item, XMLSerializer w) throws SAXException, IOException, XMLStreamException {
    if(item==null) {
        w.writeXsiNilTrue();
    } else {
        w.childAsXsiType(item,fieldName,expected, false);
    }
}
 
Example 11
Source File: SingleElementNodeProperty.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if (v!=null) {
        Class vtype = v.getClass();
        TagAndType tt=typeNames.get(vtype); // quick way that usually works

        if(tt==null) {// slow way that always works
            for (Map.Entry<Class,TagAndType> e : typeNames.entrySet()) {
                if(e.getKey().isAssignableFrom(vtype)) {
                    tt = e.getValue();
                    break;
                }
            }
        }

        boolean addNilDecl = (o instanceof JAXBElement) && ((JAXBElement)o).isNil();
        if(tt==null) {
            // actually this is an error, because the actual type was not a sub-type
            // of any of the types specified in the annotations,
            // but for the purpose of experimenting with simple type substitution,
            // it's convenient to marshal this anyway (for example so that classes
            // generated from simple types like String can be marshalled as expected.)
            w.startElement(typeNames.values().iterator().next().tagName,null);
            w.childAsXsiType(v,fieldName,w.grammar.getBeanInfo(Object.class), addNilDecl && nillable);
        } else {
            w.startElement(tt.tagName,null);
            w.childAsXsiType(v,fieldName,tt.beanInfo, addNilDecl && nillable);
        }
        w.endElement();
    } else if (nillable) {
        w.startElement(nullTagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 12
Source File: SingleElementNodeProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if (v!=null) {
        Class vtype = v.getClass();
        TagAndType tt=typeNames.get(vtype); // quick way that usually works

        if(tt==null) {// slow way that always works
            for (Map.Entry<Class,TagAndType> e : typeNames.entrySet()) {
                if(e.getKey().isAssignableFrom(vtype)) {
                    tt = e.getValue();
                    break;
                }
            }
        }

        boolean addNilDecl = (o instanceof JAXBElement) && ((JAXBElement)o).isNil();
        if(tt==null) {
            // actually this is an error, because the actual type was not a sub-type
            // of any of the types specified in the annotations,
            // but for the purpose of experimenting with simple type substitution,
            // it's convenient to marshal this anyway (for example so that classes
            // generated from simple types like String can be marshalled as expected.)
            w.startElement(typeNames.values().iterator().next().tagName,null);
            w.childAsXsiType(v,fieldName,w.grammar.getBeanInfo(Object.class), addNilDecl && nillable);
        } else {
            w.startElement(tt.tagName,null);
            w.childAsXsiType(v,fieldName,tt.beanInfo, addNilDecl && nillable);
        }
        w.endElement();
    } else if (nillable) {
        w.startElement(nullTagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 13
Source File: ArrayElementNodeProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void serializeItem(JaxBeanInfo expected, ItemT item, XMLSerializer w) throws SAXException, IOException, XMLStreamException {
    if(item==null) {
        w.writeXsiNilTrue();
    } else {
        w.childAsXsiType(item,fieldName,expected, false);
    }
}
 
Example 14
Source File: SingleElementLeafProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    boolean hasValue = xacc.hasValue(o);

    Object obj = null;

    try {
        obj = acc.getUnadapted(o);
    } catch (AccessorException ae) {
        ; // noop
    }

    Class valueType = acc.getValueType();

    // check for different type than expected. If found, add xsi:type declaration
    if (xsiTypeNeeded(o, w, obj, valueType)) {
        w.startElement(tagName, outerPeer);
        w.childAsXsiType(obj, fieldName, w.grammar.getBeanInfo(valueType), false);
        w.endElement();
    } else {  // current type is expected
        if (hasValue) {
            xacc.writeLeafElement(w, tagName, o, fieldName);
        } else if (nillable) {
            w.startElement(tagName, null);
            w.writeXsiNilTrue();
            w.endElement();
        }
    }
}
 
Example 15
Source File: SingleMapNodeProperty.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if(v!=null) {
        bareStartTag(w,tagName,v);
        for( Map.Entry e : (Set<Map.Entry>)v.entrySet() ) {
            bareStartTag(w,entryTag,null);

            Object key = e.getKey();
            if(key!=null) {
                w.startElement(keyTag,key);
                w.childAsXsiType(key,fieldName,keyBeanInfo, false);
                w.endElement();
            }

            Object value = e.getValue();
            if(value!=null) {
                w.startElement(valueTag,value);
                w.childAsXsiType(value,fieldName,valueBeanInfo, false);
                w.endElement();
            }

            w.endElement();
        }
        w.endElement();
    } else
    if(nillable) {
        w.startElement(tagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 16
Source File: SingleMapNodeProperty.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException {
    ValueT v = acc.get(o);
    if(v!=null) {
        bareStartTag(w,tagName,v);
        for( Map.Entry e : (Set<Map.Entry>)v.entrySet() ) {
            bareStartTag(w,entryTag,null);

            Object key = e.getKey();
            if(key!=null) {
                w.startElement(keyTag,key);
                w.childAsXsiType(key,fieldName,keyBeanInfo, false);
                w.endElement();
            }

            Object value = e.getValue();
            if(value!=null) {
                w.startElement(valueTag,value);
                w.childAsXsiType(value,fieldName,valueBeanInfo, false);
                w.endElement();
            }

            w.endElement();
        }
        w.endElement();
    } else
    if(nillable) {
        w.startElement(tagName,null);
        w.writeXsiNilTrue();
        w.endElement();
    }
}
 
Example 17
Source File: ArrayElementProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void serializeListBody(BeanT beanT, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException {
        ListIterator<ItemT> itr = lister.iterator(list, w);

        boolean isIdref = itr instanceof Lister.IDREFSIterator; // UGLY

        while(itr.hasNext()) {
            try {
                ItemT item = itr.next();
                if (item != null) {
                    Class itemType = item.getClass();
                    if(isIdref)
                        // This should be the only place where we need to be aware
                        // that the iterator is iterating IDREFS.
                        itemType = ((Lister.IDREFSIterator)itr).last().getClass();

                    // normally, this returns non-null
                    TagAndType tt = typeMap.get(itemType);
                    while(tt==null && itemType!=null) {
                        // otherwise we'll just have to try the slow way
                        itemType = itemType.getSuperclass();
                        tt = typeMap.get(itemType);
                    }

                    if(tt==null) {
                        // item is not of the expected type.
//                        w.reportError(new ValidationEventImpl(ValidationEvent.ERROR,
//                            Messages.UNEXPECTED_JAVA_TYPE.format(
//                                item.getClass().getName(),
//                                getExpectedClassNameList()
//                            ),
//                            w.getCurrentLocation(fieldName)));
//                        continue;

                        // see the similar code in SingleElementNodeProperty.
                        // for the purpose of simple type substitution, make it a non-error

                        w.startElement(typeMap.values().iterator().next().tagName,null);
                        w.childAsXsiType(item,fieldName,w.grammar.getBeanInfo(Object.class), false);
                    } else {
                        w.startElement(tt.tagName,null);
                        serializeItem(tt.beanInfo,item,w);
                    }

                    w.endElement();
                } else {
                    if(nillableTagName!=null) {
                        w.startElement(nillableTagName,null);
                        w.writeXsiNilTrue();
                        w.endElement();
                    }
                }
            } catch (JAXBException e) {
                w.reportError(fieldName,e);
                // recover by ignoring this item
            }
        }
    }
 
Example 18
Source File: ArrayElementProperty.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected void serializeListBody(BeanT beanT, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException {
        ListIterator<ItemT> itr = lister.iterator(list, w);

        boolean isIdref = itr instanceof Lister.IDREFSIterator; // UGLY

        while(itr.hasNext()) {
            try {
                ItemT item = itr.next();
                if (item != null) {
                    Class itemType = item.getClass();
                    if(isIdref)
                        // This should be the only place where we need to be aware
                        // that the iterator is iterating IDREFS.
                        itemType = ((Lister.IDREFSIterator)itr).last().getClass();

                    // normally, this returns non-null
                    TagAndType tt = typeMap.get(itemType);
                    while(tt==null && itemType!=null) {
                        // otherwise we'll just have to try the slow way
                        itemType = itemType.getSuperclass();
                        tt = typeMap.get(itemType);
                    }

                    if(tt==null) {
                        // item is not of the expected type.
//                        w.reportError(new ValidationEventImpl(ValidationEvent.ERROR,
//                            Messages.UNEXPECTED_JAVA_TYPE.format(
//                                item.getClass().getName(),
//                                getExpectedClassNameList()
//                            ),
//                            w.getCurrentLocation(fieldName)));
//                        continue;

                        // see the similar code in SingleElementNodeProperty.
                        // for the purpose of simple type substitution, make it a non-error

                        w.startElement(typeMap.values().iterator().next().tagName,null);
                        w.childAsXsiType(item,fieldName,w.grammar.getBeanInfo(Object.class), false);
                    } else {
                        w.startElement(tt.tagName,null);
                        serializeItem(tt.beanInfo,item,w);
                    }

                    w.endElement();
                } else {
                    if(nillableTagName!=null) {
                        w.startElement(nillableTagName,null);
                        w.writeXsiNilTrue();
                        w.endElement();
                    }
                }
            } catch (JAXBException e) {
                w.reportError(fieldName,e);
                // recover by ignoring this item
            }
        }
    }
 
Example 19
Source File: ArrayElementProperty.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void serializeListBody(BeanT beanT, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException {
        ListIterator<ItemT> itr = lister.iterator(list, w);

        boolean isIdref = itr instanceof Lister.IDREFSIterator; // UGLY

        while(itr.hasNext()) {
            try {
                ItemT item = itr.next();
                if (item != null) {
                    Class itemType = item.getClass();
                    if(isIdref)
                        // This should be the only place where we need to be aware
                        // that the iterator is iterating IDREFS.
                        itemType = ((Lister.IDREFSIterator)itr).last().getClass();

                    // normally, this returns non-null
                    TagAndType tt = typeMap.get(itemType);
                    while(tt==null && itemType!=null) {
                        // otherwise we'll just have to try the slow way
                        itemType = itemType.getSuperclass();
                        tt = typeMap.get(itemType);
                    }

                    if(tt==null) {
                        // item is not of the expected type.
//                        w.reportError(new ValidationEventImpl(ValidationEvent.ERROR,
//                            Messages.UNEXPECTED_JAVA_TYPE.format(
//                                item.getClass().getName(),
//                                getExpectedClassNameList()
//                            ),
//                            w.getCurrentLocation(fieldName)));
//                        continue;

                        // see the similar code in SingleElementNodeProperty.
                        // for the purpose of simple type substitution, make it a non-error

                        w.startElement(typeMap.values().iterator().next().tagName,null);
                        w.childAsXsiType(item,fieldName,w.grammar.getBeanInfo(Object.class), false);
                    } else {
                        w.startElement(tt.tagName,null);
                        serializeItem(tt.beanInfo,item,w);
                    }

                    w.endElement();
                } else {
                    if(nillableTagName!=null) {
                        w.startElement(nillableTagName,null);
                        w.writeXsiNilTrue();
                        w.endElement();
                    }
                }
            } catch (JAXBException e) {
                w.reportError(fieldName,e);
                // recover by ignoring this item
            }
        }
    }
 
Example 20
Source File: ArrayElementProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected void serializeListBody(BeanT beanT, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException {
        ListIterator<ItemT> itr = lister.iterator(list, w);

        boolean isIdref = itr instanceof Lister.IDREFSIterator; // UGLY

        while(itr.hasNext()) {
            try {
                ItemT item = itr.next();
                if (item != null) {
                    Class itemType = item.getClass();
                    if(isIdref)
                        // This should be the only place where we need to be aware
                        // that the iterator is iterating IDREFS.
                        itemType = ((Lister.IDREFSIterator)itr).last().getClass();

                    // normally, this returns non-null
                    TagAndType tt = typeMap.get(itemType);
                    while(tt==null && itemType!=null) {
                        // otherwise we'll just have to try the slow way
                        itemType = itemType.getSuperclass();
                        tt = typeMap.get(itemType);
                    }

                    if(tt==null) {
                        // item is not of the expected type.
//                        w.reportError(new ValidationEventImpl(ValidationEvent.ERROR,
//                            Messages.UNEXPECTED_JAVA_TYPE.format(
//                                item.getClass().getName(),
//                                getExpectedClassNameList()
//                            ),
//                            w.getCurrentLocation(fieldName)));
//                        continue;

                        // see the similar code in SingleElementNodeProperty.
                        // for the purpose of simple type substitution, make it a non-error

                        w.startElement(typeMap.values().iterator().next().tagName,null);
                        w.childAsXsiType(item,fieldName,w.grammar.getBeanInfo(Object.class), false);
                    } else {
                        w.startElement(tt.tagName,null);
                        serializeItem(tt.beanInfo,item,w);
                    }

                    w.endElement();
                } else {
                    if(nillableTagName!=null) {
                        w.startElement(nillableTagName,null);
                        w.writeXsiNilTrue();
                        w.endElement();
                    }
                }
            } catch (JAXBException e) {
                w.reportError(fieldName,e);
                // recover by ignoring this item
            }
        }
    }