Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing xml. Objects with relation (one-to-many)
    primarykey
    data
    text
    <p>I have a xml file:</p> <pre><code>&lt;?xml version='1.0' encoding='windows-1251' standalone='yes'?&gt;&lt;XML&gt; &lt;Result&gt;Ok&lt;/Result&gt; &lt;Error&gt;&lt;/Error&gt; &lt;Remark&gt;&lt;/Remark&gt; &lt;Data&gt; &lt;Theatres&gt; &lt;Theatre ID='1' ShowBusyPlaces='1'&gt; // maybe more than one &lt;Name&gt;&lt;![CDATA[PlaceName]]&gt;&lt;/Name&gt; &lt;NameFull&gt;&lt;![CDATA[PlaceName]]&gt;&lt;/NameFull&gt; &lt;Remark&gt;&lt;![CDATA[]]&gt;&lt;/Remark&gt; &lt;Address&gt;&lt;![CDATA[]]&gt;&lt;/Address&gt; &lt;Halls Count='3'&gt; &lt;Hall ID='1'&gt; &lt;Name&gt;&lt;![CDATA[Redisson]]&gt;&lt;/Name&gt; &lt;Levels Count='1'&gt; &lt;Level ID='1' Geometry='1'&gt; // maybe more than one &lt;Name&gt;&lt;![CDATA[Radisson]]&gt;&lt;/Name&gt; &lt;/Level&gt; &lt;/Levels&gt; &lt;/Hall&gt; &lt;Hall ID='3'&gt; &lt;Name&gt;&lt;![CDATA[Test 2]]&gt;&lt;/Name&gt; &lt;Levels Count='0'&gt;&lt;/Levels&gt; &lt;/Hall&gt; &lt;Hall ID='2'&gt; &lt;Name&gt;&lt;![CDATA[тест]]&gt;&lt;/Name&gt; &lt;Levels Count='1'&gt; &lt;Level ID='4' Geometry='2'&gt; &lt;Name&gt;&lt;![CDATA[ттт]]&gt;&lt;/Name&gt; &lt;/Level&gt; &lt;/Levels&gt; &lt;/Hall&gt; &lt;/Halls&gt; &lt;/Theatre&gt; &lt;/Theatres&gt; &lt;/Data&gt; &lt;/XML&gt; </code></pre> <p>And, I have two classes: <code>BasePlace</code> and <code>HallPlan</code> (relation as one-to-many) </p> <p><code>BasePlace</code>: <code>OID, Name, Address</code><br> <code>HallPlan</code>: <code>OID, BasePlaceId, HallId, LevelId</code> </p> <p>For example above the results must be: </p> <pre><code>BasePlace table: OID Name Address 1 PlaceName HallPlan table: OID BasePlaceId, HallId, LevelId 1 1 1 1 2 1 2 4 3 1 3 null </code></pre> <p>This query return fills only <code>BasePlace</code> object:</p> <pre><code>var places = from element in XDocument.Parse(xml).Descendants("Theatre") select new BasePlace { OIDPremiera = (int) element.Attribute("ID"), Name = (string) element.Element("Name"), Address = (string) element.Element("Address"), }; </code></pre> <p>How to fill <code>HallPlan</code> properly( with all fields and relation to <code>BasePlace</code>)? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload