Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's largely a matter of preference. I use Elements for grouping and attributes for data where possible as I see this as more compact than the alternative.</p> <p>For example I prefer.....</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;data&gt; &lt;people&gt; &lt;person name="Rory" surname="Becker" age="30" /&gt; &lt;person name="Travis" surname="Illig" age="32" /&gt; &lt;person name="Scott" surname="Hanselman" age="34" /&gt; &lt;/people&gt; &lt;/data&gt; </code></pre> <p>...Instead of....</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;data&gt; &lt;people&gt; &lt;person&gt; &lt;name&gt;Rory&lt;/name&gt; &lt;surname&gt;Becker&lt;/surname&gt; &lt;age&gt;30&lt;/age&gt; &lt;/person&gt; &lt;person&gt; &lt;name&gt;Travis&lt;/name&gt; &lt;surname&gt;Illig&lt;/surname&gt; &lt;age&gt;32&lt;/age&gt; &lt;/person&gt; &lt;person&gt; &lt;name&gt;Scott&lt;/name&gt; &lt;surname&gt;Hanselman&lt;/surname&gt; &lt;age&gt;34&lt;/age&gt; &lt;/person&gt; &lt;/people&gt; &lt;/data&gt; </code></pre> <p>However if I have data which does not represent easily inside of say 20-30 characters or contains many quotes or other characters that need escaping then I'd say it's time to break out the elements... possibly with CData blocks.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;data&gt; &lt;people&gt; &lt;person name="Rory" surname="Becker" age="30" &gt; &lt;comment&gt;A programmer whose interested in all sorts of misc stuff. His Blog can be found at http://rorybecker.blogspot.com and he's on twitter as @RoryBecker&lt;/comment&gt; &lt;/person&gt; &lt;person name="Travis" surname="Illig" age="32" &gt; &lt;comment&gt;A cool guy for who has helped me out with all sorts of SVn information&lt;/comment&gt; &lt;/person&gt; &lt;person name="Scott" surname="Hanselman" age="34" &gt; &lt;comment&gt;Scott works for MS and has a great podcast available at http://www.hanselminutes.com &lt;/comment&gt; &lt;/person&gt; &lt;/people&gt; &lt;/data&gt; </code></pre>
 

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