Package org.jibx.runtime.impl

Examples of org.jibx.runtime.impl.MarshallingContext.attribute()


            // generate the element start tag
            MarshallingContext ctx = (MarshallingContext)ictx;
            ctx.startTagAttributes(m_index, m_name);
           
            // add attribute reference to object ID
            ctx.attribute(0, getAttributeName(), getIdValue(obj));
           
            // close start tag for empty element
            ctx.closeStartEmpty();
        }
    }
View Full Code Here


                Object value = entry.getValue();
                if (value != null) {
                   
                    // write element with key attribute
                    ctx.startTagAttributes(m_index, ENTRY_ELEMENT_NAME);
                    ctx.attribute(m_index, KEY_ATTRIBUTE_NAME,
                        entry.getKey().toString());
                   
                    // translate value object class to schema type
                    String tname = value.getClass().getName();
                    int type = s_javaTypesEnum.getValue(tname);
View Full Code Here

                            " with key " + entry.getKey() +
                            " is not a supported type");
                    }
                   
                    // generate xsi:type attribute for value
                    ctx.attribute(ixsi, TYPE_ATTRIBUTE_NAME,
                        XSD_PREFIX_LEAD + s_schemaTypesEnum.getName(type));
                    ctx.closeStartContent();
                   
                    // handle the actual value conversion based on type
                    switch (type) {
View Full Code Here

            Iterator iter = map.entrySet().iterator();
            while (iter.hasNext()) {
                Map.Entry entry = (Map.Entry)iter.next();
                ctx.startTagAttributes(m_index, ENTRY_ELEMENT_NAME);
                if (entry.getKey() != null) {
                    ctx.attribute(m_index, KEY_ATTRIBUTE_NAME,
                        entry.getKey().toString());
                }
                ctx.closeStartContent();
                if (entry.getValue() instanceof IMarshallable) {
                    ((IMarshallable)entry.getValue()).marshal(ctx);
View Full Code Here

                }
            } else if (value.equals(obj)) {
               
                // generate reference to previously-defined item
                ctx.startTagAttributes(m_index, m_name);
                ctx.attribute(0, getAttributeName(), id);
                ctx.closeStartEmpty();
               
            } else {
                throw new JiBXException("Duplicate definition for ID " + id);
            }
View Full Code Here

            // loop through all entries in map
            Iterator iter = map.entrySet().iterator();
            while (iter.hasNext()) {
                Map.Entry entry = (Map.Entry)iter.next();
                ctx.startTagAttributes(m_index, getEntryElementName());
                ctx.attribute(m_index, getKeyAttributeName(),
                    entry.getKey().toString());
                ctx.closeStartContent();
                if (entry.getValue() instanceof IMarshallable) {
                    ((IMarshallable)entry.getValue()).marshal(ctx);
                    ctx.endTag(m_index, getEntryElementName());
View Full Code Here

         throw new JiBXException("Invalid object type for marshaller");

      MarshallingContext ctx = (MarshallingContext)ictx;
      Properties map = (Properties)obj;
      MarshallingContext mContext = ctx.startTagAttributes(marshallIndex, marshallName);
      mContext.attribute(marshallIndex, SIZE_ATTRIBUTE_NAME, map.size()).closeStartContent();

      Iterator<Map.Entry<String, String>> iter = map.entrySet().iterator();
      while (iter.hasNext())
      {
         Map.Entry<String, String> entry = iter.next();
View Full Code Here

            throw new JiBXException("Invalid object type for marshaller");

        MarshallingContext ctx = (MarshallingContext) ictx;
        Properties map = (Properties) obj;
        MarshallingContext mContext = ctx.startTagAttributes(marshallIndex, marshallName);
        mContext.attribute(marshallIndex, SIZE_ATTRIBUTE_NAME, map.size()).closeStartContent();

        Iterator<Map.Entry<String, String>> iter = map.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry<String, String> entry = iter.next();
            String key = entry.getKey().toString();
View Full Code Here

            throw new JiBXException("Invalid object type for marshaller");

        MarshallingContext ctx = (MarshallingContext) ictx;
        Properties map = (Properties) obj;
        MarshallingContext mContext = ctx.startTagAttributes(marshallIndex, marshallName);
        mContext.attribute(marshallIndex, SIZE_ATTRIBUTE_NAME, map.size()).closeStartContent();

        Iterator<Map.Entry<String, String>> iter = map.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry<String, String> entry = iter.next();
            String key = entry.getKey().toString();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.