/[cashew-s-editor]/cashews/src/nongnu/cashews/xml/Serializer.java
ViewVC logotype

Diff of /cashews/src/nongnu/cashews/xml/Serializer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gnu_andrew, Wed May 4 22:14:05 2005 UTC revision 1.2 by gnu_andrew, Fri May 6 10:26:51 2005 UTC
# Line 30  import java.util.Collection; Line 30  import java.util.Collection;
30  import java.util.LinkedList;  import java.util.LinkedList;
31  import java.util.List;  import java.util.List;
32    
33    import nongnu.cashews.language.grounding.SoapOperation;
34    import nongnu.cashews.language.process.AtomicProcess;
35  import nongnu.cashews.language.process.CompositeProcess;  import nongnu.cashews.language.process.CompositeProcess;
36    import nongnu.cashews.language.process.Performance;
37  import nongnu.cashews.language.process.Sequence;  import nongnu.cashews.language.process.Sequence;
38  import nongnu.cashews.xml.schema.TypeMapper;  import nongnu.cashews.xml.schema.TypeMapper;
39  import nongnu.cashews.xml.schema.XsdType;  import nongnu.cashews.xml.schema.XsdType;
# Line 96  public class Serializer Line 99  public class Serializer
99    {    {
100      List<Field> fields = new LinkedList<Field>();      List<Field> fields = new LinkedList<Field>();
101      Class clazz = object.getClass();      Class clazz = object.getClass();
102      Element objRoot = createElement(document, clazz.getSimpleName());      String elementName = null;
103        CustomXmlizable customObject = null;
104        if (object instanceof CustomXmlizable)
105          {
106            customObject = (CustomXmlizable) object;
107            elementName = customObject.getElementName();
108          }
109        if (elementName == null)
110          elementName = clazz.getSimpleName();
111        Element objRoot = createElement(document, elementName);
112      while (clazz != null)      while (clazz != null)
113        {        {
114          fields.addAll(0, Arrays.asList(clazz.getDeclaredFields()));          fields.addAll(0, Arrays.asList(clazz.getDeclaredFields()));
# Line 104  public class Serializer Line 116  public class Serializer
116        }        }
117      for (Field field: fields)      for (Field field: fields)
118        {        {
119            System.out.println("field: " + field);
120          Object value = field.get(object);          Object value = field.get(object);
121            System.out.println("value: " + value);
122          if (value == null)          if (value == null)
123            continue;            continue;
124          if (value instanceof Collection)          if (value instanceof Collection)
# Line 113  public class Serializer Line 127  public class Serializer
127              for (Object obj : collection)              for (Object obj : collection)
128                {                {
129                  if (obj instanceof Xmlizable)                  if (obj instanceof Xmlizable)
130                    serialize((Xmlizable) value, objRoot, document);                    serialize((Xmlizable) obj, objRoot, document);
131                }                }
132            }            }
133          else if (value instanceof Xmlizable)          else if (value instanceof Xmlizable)
# Line 201  public class Serializer Line 215  public class Serializer
215    {    {
216      CompositeProcess process = new CompositeProcess("MyProcess");      CompositeProcess process = new CompositeProcess("MyProcess");
217      Sequence sequence = new Sequence();      Sequence sequence = new Sequence();
218        Performance performance = new Performance("MyPerform");
219        AtomicProcess atomic1 = new AtomicProcess("MyAtomic");
220        atomic1.setGrounding(new SoapOperation());
221        performance.setProcess(atomic1);
222        sequence.add(performance);
223      process.setControlStructure(sequence);      process.setControlStructure(sequence);
224      initializeImpl();      initializeImpl();
225      Document document = domImpl.createDocument(null,null,null);      Document document = domImpl.createDocument(null,null,null);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26