Hi

I have car object as shown below. I am using custom toXMLString()
method to convert the object into the xml representation. In the
method i am using the ObjetUtil.getClassInfo(this). The output of the
toXMLString method varies sometimes it is 
1.
<car>
   <tyre>8</tyre>
   <color>8</color>
   <light>6</light>
   <mirror>9</mirror>
</car>

2.
<car>
   <light>6</light>
   <mirror>9</mirror>
   <tyre>8</tyre>
   <color>8</color>
</car>

I want to have the fix order of the nodes as I like. How can we
achieve this???.
I know this can be done but i do not know how???? Any pointers....

class Car
{
  public var tyre:
  public var color;
  public var light;
  public var mirror:

   public function toXMLString():String
   {
       var xmlString:String="<car>";
       var details:Object = ObjectUtil.getClassInfo(this);
       var properties:Array = details.properties;

       for each(var qName:QName in properties)
       {
           if ( StringUtil.trim(this [ qName.localName ]).length > 0 )
                                        xmlString = xmlString + "<" + 
qName.localName + ">" + this [
qName.localName ] + "</" + qName.localName + ">";
       }
       
        xmlString = xmlString + "</car>"; 
         

   }

}

Thanks
ilikeflex

Reply via email to