Using Visual Studio to parse Green Button data

147 views
Skip to first unread message

Linda F-G

unread,
Oct 7, 2013, 3:40:36 PM10/7/13
to energy...@googlegroups.com
I'm trying to parse GreenButton data that we will be getting from many different clients using Visual Studio C#.  I've used the XSD command available in Visual Studio to create classes based on the espiderived.xsd.   I am hoping to deserialize my green button xml into these classes and navigate through the data this way instead of doing an xpath each time.  However, I'm not sure that I understand the classes that get produced.  Is there some top-level object in this hierachy?  To me, it almost looks like there are many objects (i.e. Authorization, MeterReading, ReadingType...) that are all at the same level of the hierarchy.  I'm trying to find out if there is one parent object that contains these.  Am I just missing something?  Can anyone fill in the gaps for me here?

John Teeter

unread,
Oct 8, 2013, 4:05:30 PM10/8/13
to energyos_espi
I'm around for a Q&A on this topic.  ping me on email.

John (or jateeter on skype)


On Mon, Oct 7, 2013 at 1:40 PM, Linda F-G <lcfarr...@gmail.com> wrote:
I'm trying to parse GreenButton data that we will be getting from many different clients using Visual Studio C#.  I've used the XSD command available in Visual Studio to create classes based on the espiderived.xsd.   I am hoping to deserialize my green button xml into these classes and navigate through the data this way instead of doing an xpath each time.  However, I'm not sure that I understand the classes that get produced.  Is there some top-level object in this hierachy?  To me, it almost looks like there are many objects (i.e. Authorization, MeterReading, ReadingType...) that are all at the same level of the hierarchy.  I'm trying to find out if there is one parent object that contains these.  Am I just missing something?  Can anyone fill in the gaps for me here?

--
--
You received this message because you are subscribed to the "energyos_espi" group.
To post to this group, send email to energy...@googlegroups.com
To unsubscribe from this group, send email to: energyos_esp...@googlegroups.com
 
http://www.energyos.org/espi/
 
---
You received this message because you are subscribed to the Google Groups "energyos_espi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to energyos_esp...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

John Teeter

unread,
Oct 8, 2013, 4:43:53 PM10/8/13
to energy...@googlegroups.com
OData.org will provide you with part of the background you need. It describes the usage of the Atom entities, in particular <entry>, <link> and <contents>.The second thing to note is that an Atom <feed> <entry> .... <contents> <espi entity> </contents></entry></feed>.

So all the espiDerived.xsd entities are always contained in a feed and the entry/contents describe the espi entity itself. In addtion, you need to construct (during the parse if possible for you:) the associations that need to exist between the espi entities. For example, the:

 <link rel="self" href="...." />
and
 <link rel="related" href="...." />

are quite important for use during fixup of the espi entities,  (making sure MeterReadings always point to a UsagePoint for example). 

I'm trying to write more on this topic here:


So re: espi objects, you need to think of the feed as a collection of n <entry> ... </entry> entities, each of which you might use to create a espi entity. 

hth

jt


On Mon, Oct 7, 2013 at 1:40 PM, Linda F-G <lcfarr...@gmail.com> wrote:
I'm trying to parse GreenButton data that we will be getting from many different clients using Visual Studio C#.  I've used the XSD command available in Visual Studio to create classes based on the espiderived.xsd.   I am hoping to deserialize my green button xml into these classes and navigate through the data this way instead of doing an xpath each time.  However, I'm not sure that I understand the classes that get produced.  Is there some top-level object in this hierachy?  To me, it almost looks like there are many objects (i.e. Authorization, MeterReading, ReadingType...) that are all at the same level of the hierarchy.  I'm trying to find out if there is one parent object that contains these.  Am I just missing something?  Can anyone fill in the gaps for me here?

--
--
You received this message because you are subscribed to the "energyos_espi" group.
To post to this group, send email to energy...@googlegroups.com
To unsubscribe from this group, send email to: energyos_esp...@googlegroups.com
 
http://www.energyos.org/espi/
 
---
You received this message because you are subscribed to the Google Groups "energyos_espi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to energyos_esp...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
===== 
Phone: 208 875 2269
Skype: jateeter

Linda F-G

unread,
Oct 9, 2013, 9:13:50 AM10/9/13
to energy...@googlegroups.com
The "link" element is what I am having difficulty understanding.  Not sure how it is used.  i.e. if I see a link such as this:  "/User/9b6c7063/UsagePoint/01".  What do I do with it when parsing the data.  (In the sample code that I'm looking at I cannot tell what this statement would correspond with.)

John Teeter

unread,
Oct 9, 2013, 2:13:20 PM10/9/13
to energyos_espi
I added a bit of description at:


under "Concepts".

Briefly,  the:
===
<feed>
<entry> 
   ...
  <link   ref="self" href="/User/9b6c7063/UsagePoint/01" />
  ...
  <content>
     <UsagePoint>
        ...
     </UsagePoint>
  </content>
 </entry>

===
provides both an XML representation in the <content> tag AND a moniker in the <link> that allows other <entry> ... </entry> to point to it. A succeeding entry in the feed might be:

===

<entry>
   <link rel="self" href="/User/9b6c7063/UsagePoint/01/MeterReading/01" />
   <link rel="related" href="/User/9b6c7063/UsagePoint/01" />
   <content>
     <MeterReading>
      ...
     </MeterReading>
    </content>
</entry>
.....
<entry>
   <link rel="self" href="/User/9b6c7063/UsagePoint/01/MeterReading/02" />
   <link rel="related" href="/User/9b6c7063/UsagePoint/01" />
   <content>
     <MeterReading>
      ...
     </MeterReading>
    </content>
</entry>
</feed>


--
Reply all
Reply to author
Forward
0 new messages