Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL LOAD XML missing child nodes on import
    primarykey
    data
    text
    <p>I'm trying to use LOAD XML for the first time and have for the most part got the results i want insofar that the majority of the XML data gets transferred into the database table and into their respective columns, but two columns are not importing correctly.</p> <p>Let me show an example of the typical XML structure so perhaps you can see why(this is obviously just one record from the file). </p> <p><strong>NOTE:</strong> The XML structure cannot be changed, this is read from a file outside of my control, so i have to work with the structure as is.</p> <pre><code>&lt;trait name="ArmorBldg_R001"&gt; &lt;dbid&gt;450&lt;/dbid&gt; &lt;traittype&gt;ArmorBuilding&lt;/traittype&gt; &lt;rarity&gt;rare&lt;/rarity&gt; &lt;icon&gt;UserInterface\Icons\Equipment\ArmBuildR3_ua&lt;/icon&gt; &lt;rollovertextid&gt;53253&lt;/rollovertextid&gt; &lt;displaynameid&gt;53254&lt;/displaynameid&gt; &lt;offertype&gt;eOfferCivMatching&lt;/offertype&gt; &lt;visualfactor type="Body" factor="2.0000"/&gt; &lt;sellable&gt;1&lt;/sellable&gt; &lt;tradeable&gt;1&lt;/tradeable&gt; &lt;destroyable&gt;1&lt;/destroyable&gt; &lt;effects&gt; &lt;effect type="Data" bonus="true" amount="1.0122" scaling="0.0031" subtype="Armor" visible="true" damagetype="Ranged" relativity="Percent"&gt; &lt;target type="Player"/&gt; &lt;/effect&gt; &lt;effect type="Data" bonus="true" amount="1.0197" scaling="0.0052" subtype="Damage" visible="true" allactions="1" relativity="Percent"&gt; &lt;target type="Player"/&gt; &lt;/effect&gt; &lt;effect type="Data" bonus="true" amount="1.0092" scaling="0.0023" subtype="LOS" visible="true" relativity="Percent"&gt; &lt;target type="Player"/&gt; &lt;/effect&gt; &lt;/effects&gt; &lt;/trait&gt; </code></pre> <p>I'm importing using..</p> <pre><code>LOAD XML LOCAL INFILE 'C:\path\to\xmlfile\example.xml' INTO TABLE mytable ROWS IDENTIFIED BY '&lt;trait&gt;'; </code></pre> <p>And here's the table structure.</p> <pre><code>CREATE TABLE `traits` ( `name` varchar(40) NOT NULL, `dbid` smallint(5) unsigned NOT NULL, `traittype` varchar(40) NOT NULL, `rarity` varchar(10) NOT NULL, `icon` varchar(100) NOT NULL, `rollovertextid` mediumint(8) unsigned NOT NULL, `displaynameid` mediumint(8) unsigned NOT NULL, `offertype` varchar(20) NOT NULL, `visualfactor` text NOT NULL, `sellable` tinyint(1) NOT NULL, `tradeable` tinyint(1) NOT NULL, `destroyable` tinyint(1) NOT NULL, `effects` text NOT NULL, UNIQUE KEY `dbid` (`dbid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; </code></pre> <p>All records import correctly, but it's leaving the <code>visualfactor</code> and <code>effects</code> columns empty for every record. </p> <p>I've been reading the following two pages..</p> <p><a href="http://dev.mysql.com/doc/refman/5.5/en/load-xml.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/load-xml.html</a><br> <a href="http://dev.mysql.com/doc/refman/5.5/en/load-data.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/load-data.html</a></p> <p>..but unfortunately i'm baffled on where to even start(those docs really do little to explain themself), could anyone offer some pointers? even if it's just a webpage with suitable(and easy to follow) examples.</p> <p>Thanks in advance to anyone who can offer some guidance.</p>
    singulars
    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.
 

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