Note that there are some explanatory texts on larger screens.

plurals
  1. POphp remove extra brackets from xml
    primarykey
    data
    text
    <p>I need to parse a huge xml of photo albums. I'm using PHP SimpleXML to parse, however it fails on some entries with errors because extra brackets may appear in some cases, see 'description' or 'CameraModel' tags.</p> <p>How do I clean up xml before loading it with SimpleXML? If possible, replace extra brackets with '_' underscore.</p> <p>Here is my xml:</p> <pre class="lang-xml prettyprint-override"><code>&lt;values&gt; &lt;photos&gt; &lt;photo&gt;&lt;photoID&gt;4521&lt;/photoID&gt; &lt;name&gt;&lt;/name&gt; &lt;description&gt;Seattle&lt;3&lt;/description&gt; &lt;fileName&gt;S5001497.jpg&lt;/fileName&gt; &lt;fileSize&gt;177513&lt;/fileSize&gt; &lt;fileSizeOriginal&gt;2359669&lt;/fileSizeOriginal&gt; &lt;width&gt;1200&lt;/width&gt; &lt;height&gt;900&lt;/height&gt; &lt;exif&gt;&lt;CameraModel&gt;&lt;Digimax S500 / Kenox S500&lt;/CameraModel&gt; &lt;CameraMake&gt;Samsung Techwin&lt;/CameraMake&gt; &lt;DateTime&gt;2008-07-12 17:37:24&lt;/DateTime&gt; &lt;Version&gt;220&lt;/Version&gt; &lt;SourceWidth&gt;2592&lt;/SourceWidth&gt; &lt;SourceHeight&gt;1944&lt;/SourceHeight&gt; &lt;Orientation&gt;1&lt;/Orientation&gt; &lt;FlashUsed&gt;89&lt;/FlashUsed&gt; &lt;FocalLength&gt;5.8&lt;/FocalLength&gt; &lt;ExposureTime&gt;0.033333&lt;/ExposureTime&gt; &lt;Brightness&gt;&lt;/Brightness&gt; &lt;ApertureFNumber&gt;2.8&lt;/ApertureFNumber&gt; &lt;ISO&gt;177&lt;/ISO&gt; &lt;ExposureProgram&gt;0&lt;/ExposureProgram&gt; &lt;/exif&gt; &lt;type&gt;photo&lt;/type&gt; &lt;GPS&gt;&lt;/GPS&gt; &lt;/photo&gt; &lt;/photos&gt; &lt;/values&gt; </code></pre>
    singulars
    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.
 

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