On 08/13/2009 06:40 PM, Bjoern Geuken wrote:
> Hi,
> 
> I'm trying to gave the status rest-service a nicer xml format, but I faced 
> some problems by sending the times of the values. Inside a browser the xml-
> tree looks like that:
> 
> <status>
>   <metricgroup group_name="memory">
>     <metric name="memory-used">
>       <label type="value">
>         <value dateTime="1250178710">1.4260408320e+09</value>
>         <value dateTime="1250178600">1.4165012480e+09</value>
>         <value dateTime="1250178590">1.4164602880e+09</value>
> ....
> 
> But when the webclient fetches the data with @client.find(...), it misses the 
> dateTime attributes:
> 
> #<YaST::ServiceResource::Proxies::Status:0x7f5c68fd0c98 @prefix_options={}, 
> @attributes={"metricgroup"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup:0x7f5c68f22288
>  
> @prefix_options={}, @attributes={"group_name"=>"memory", 
> "metric"=>[#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric:0x7f5c68f1fb28
>  
> @prefix_options={}, 
> @attributes={"label"=>#<YaST::ServiceResource::Proxies::Status::Metricgroup::Metric::Label:0x7f5c68f1f038
>  
> @prefix_options={}, @attributes={"values"=>
> ["1.4095081472e+09", 
> "1.4097989632e+09", 
> ..... 
> "1.4097973248e+09"], "type"=>"value"}>, "name"=>"memory-used"}>,
> ...
> 
> It seems that the last branch of an xml-tree  (or elements with content?) 
> can't have any attributes. Is this the expected behaviour or maybe a bug?
> 
> Björn


Yes, I also face this problem. I solve it by using map or array, so
resulting xml looks like

 <status>
   <metricgroup group_name="memory">
     <metric name="memory-used">
       <label type="array"> //array because it is array of measures
         <measure>
                <dateTime>1250178710</dateTime>
                <value>1.4260408320e+09</value>
        </measure>
        etc.

I hope this helps.
-- 
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast modules language
and time
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to