The Traverser object is used to traverse the XML class schema and either serialize or deserialize an object. This is the root of all serialization and deserialization operations. It uses the Root annotation to ensure that the XML schema matches the provided XML element. If no root element is defined the serialization and deserialization cannot be performed.
Пример #1
0
 /// <summary>
 /// Constructor for the <c>CompositeArray</c> object. This is
 /// given the array type for the contact that is to be converted. An
 /// array of the specified type is used to hold the deserialized
 /// elements and will be the same length as the number of elements.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the field type for the array being used
 /// </param>
 /// <param name="entry">
 /// this is the entry type for the array elements
 /// </param>
 /// <param name="parent">
 /// this is the name to wrap the array element with
 /// </param>
 public CompositeArray(Context context, Type type, Type entry, String parent)
 {
     this.factory = new ArrayFactory(context, type);
     this.root    = new Traverser(context);
     this.parent  = parent;
     this.entry   = entry;
 }
Пример #2
0
 /// <summary>
 /// Constructor for the <c>CompositeInlineList</c> object.
 /// This is given the list type and entry type to be used. The list
 /// type is the <c>Collection</c> implementation that is used
 /// to collect the deserialized entry objects from the XML source.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the collection type for the list used
 /// </param>
 /// <param name="entry">
 /// the entry type to be stored within the list
 /// </param>
 /// <param name="name">
 /// this is the name of the entries used for this list
 /// </param>
 public CompositeInlineList(Context context, Type type, Type entry, String name)
 {
     this.factory = new CollectionFactory(context, type);
     this.root    = new Traverser(context);
     this.entry   = entry;
     this.name    = name;
 }
Пример #3
0
 /// <summary>
 /// Constructor for the <c>CompositeValue</c> object. This
 /// will create an object capable of reading an writing composite
 /// values from an XML element. This also allows a parent element
 /// to be created to wrap the key object if desired.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this is the entry object used for configuration
 /// </param>
 /// <param name="type">
 /// this is the type of object the value represents
 /// </param>
 public CompositeValue(Context context, Entry entry, Type type) {
    this.root = new Traverser(context);
    this.style = context.Style;
    this.context = context;
    this.entry = entry;
    this.type = type;
 }
Пример #4
0
 /// <summary>
 /// Constructor for the <c>CompositeKey</c> object. This will
 /// create an object capable of reading an writing composite keys
 /// from an XML element. This also allows a parent element to be
 /// created to wrap the key object if desired.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this is the entry object used for configuration
 /// </param>
 /// <param name="type">
 /// this is the type of object the key represents
 /// </param>
 public CompositeKey(Context context, Entry entry, Type type)
 {
     this.root    = new Traverser(context);
     this.style   = context.Style;
     this.context = context;
     this.entry   = entry;
     this.type    = type;
 }
Пример #5
0
 /// <summary>
 /// Constructor for the <c>CompositeArray</c> object. This is
 /// given the array type for the contact that is to be converted. An
 /// array of the specified type is used to hold the deserialized
 /// elements and will be the same length as the number of elements.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the field type for the array being used
 /// </param>
 /// <param name="entry">
 /// this is the entry type for the array elements
 /// </param>
 /// <param name="parent">
 /// this is the name to wrap the array element with
 /// </param>
 public CompositeArray(Context context, Type type, Type entry, String parent) {
    this.factory = new ArrayFactory(context, type);
    this.root = new Traverser(context);
    this.parent = parent;
    this.entry = entry;
 }
Пример #6
0
 /// <summary>
 /// Constructor for the <c>CompositeInlineList</c> object.
 /// This is given the list type and entry type to be used. The list
 /// type is the <c>Collection</c> implementation that is used
 /// to collect the deserialized entry objects from the XML source.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the collection type for the list used
 /// </param>
 /// <param name="entry">
 /// the entry type to be stored within the list
 /// </param>
 /// <param name="name">
 /// this is the name of the entries used for this list
 /// </param>
 public CompositeInlineList(Context context, Type type, Type entry, String name) {
    this.factory = new CollectionFactory(context, type);
    this.root = new Traverser(context);
    this.entry = entry;
    this.name = name;
 }