For My website Internal Processing I am storing some data in xml(or it may not look like XML, I am trying to store which will be better to parse and store, I come up till this)
XML is only for structure,the below code/xml is stored in post-field, which is MySQL database. I am looking for better format if any, and how to parse it.
This XML was created in my CMS(Drupal), although it has nothing to do with Drupal, this is PHP question.
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 75"><defs><style>.cls-1{font-size:57.6px;}.cls-1,.cls-2{fill:#f80000;font-family:MicrosoftYaHeiUI-Bold, Microsoft YaHei UI;font-weight:700;}.cls-2{font-size:33.6px;}</style></defs><text class="cls-1" transform="translate(13.28 63.08)">19</text><text class="cls-2" transform="translate(77.56 24.81) scale(0.86 1)">c</text></svg>
<nav-head>Salamandar</nav-head>
<post><id>12</id><link>url/how-to-pet</link><title>How to Pet</title></post>
<post><id>13</id><link>url/how-to-feed</link><title>How to Feed</title></post>
<post><id>14</id><link>url/salamandar/cage/which-cage</link><title>Which Cages</title></post>
<post><id>17</id><link>url/salamandar/type/different-types</link><title>Types of Salamandar</title></post>
<post><id>19</id><link>url/salamandar/type/poisonous-breed</link><title>Poisonus Breed</title></post>
<nav-header>Keeping Safe</nav-header>
<post><id>21</id><link>url/salamandar/safety/safety-children</link><title>Keep out of Children</title></post>
<post><id>24</id><link>url/salamandar/safety/keep-out-of-dogs</link><title>Keep out of Dogs</title></post>
<post><id>27</id><link>url/salamandar/safety/keep-out-of-reptiles</link><title>Keep out of Reptiles</title></post>
<post><id>34</id><link>url/redis/salamandar/safety/fungus-free</link><title>Keep fungus free</title></post>
The above is the code/XML is stored for creating sidebar, I Want to get the above data to PHP
array
.
Is the above possible to get into an array format, or should I store another way.
<nav-header>
is the sidebar header. The above structure or XML will create sidebars markup as many ID(article) ids available, add CSS classes, and for each sidebar, only add one active
css class for that sidebar.
Please give some suggestive comment?
- Can the above be parsed to PHP array
- Is there any better form available which will make the above objective easier for PHP.
My Website/App is in building phase, please suggest, This question has nothing to do with Drupal or any CMS, it is merely PHP question. Thanks