MySQL Forums
Forum List  »  Newbie

LOAD XML LOCAL INFILE problem. Missing a field.
Posted by: Barry Galbraith
Date: May 31, 2015 10:28PM

I've got a problem trying ot load an XML file into a table.

Here's the table
CREATE TABLE `temp_aa14` (
  `SupportedTechnologyFrequencies` varchar(255) DEFAULT NULL,
  `GSM` varchar(255) DEFAULT NULL,
  `UTRAN` varchar(255) DEFAULT NULL,
  `WLAN` varchar(255) DEFAULT NULL,
  `F1700` varchar(5) DEFAULT NULL,
  `F1800` varchar(5) DEFAULT NULL,
  `F1900` varchar(5) DEFAULT NULL,
  `F2100` varchar(5) DEFAULT NULL,
  `F2400` varchar(5) DEFAULT NULL,
  `F450` varchar(5) DEFAULT NULL,
  `F5000` varchar(5) DEFAULT NULL,
  `F700` varchar(5) DEFAULT NULL,
  `F710` varchar(5) DEFAULT NULL,
  `F850` varchar(5) DEFAULT NULL,
  `F900` varchar(5) DEFAULT NULL,
  `OtherTechList` varchar(100) DEFAULT NULL,
  `OtherFrequency` varchar(100) DEFAULT NULL,
  `techName` varchar(10) DEFAULT NULL,
  `frequency` varchar(100) DEFAULT NULL,
  `available` varchar(10) DEFAULT NULL,
  `status` varchar(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Here's the XML file called d:/C_extract.xml It's part of a larger file, but this is the part I'm interested in. I get the same result from athe extract as with the full file.
<?xml version="1.0" encoding="UTF-8"?>
        <SupportedTechnologyFrequencies>
            <GSM F450="false" F700="false" F710="false" F850="true" F900="false" F1700="false" F1800="false" F1900="true" F2100="false" F2400="false" F5000="false">
                <OtherFrequencyList>
                    <OtherFrequency frequency="2600" available="false"/>
                </OtherFrequencyList>
            </GSM>
            <UTRAN F450="false" F700="false" F710="false" F850="true" F900="false" F1700="false" F1800="false" F1900="true" F2100="false" F2400="false" F5000="false">
                <OtherFrequencyList>
                    <OtherFrequency frequency="2600" available="false"/>
                </OtherFrequencyList>
            </UTRAN>
            <WLAN F450="false" F700="false" F710="false" F850="false" F900="false" F1700="false" F1800="false" F1900="false" F2100="false" F2400="false" F5000="false">
                <OtherFrequencyList>
                    <OtherFrequency frequency="2600" available="false"/>
                </OtherFrequencyList>
            </WLAN>
            <OtherTechList>
                <OtherTech techName="LTE" F450="false" F700="true" F710="false" F850="false" F900="false" F1700="true" F1800="false" F1900="false" F2100="true" F2400="false" F5000="false">
                    <OtherFrequencyList>
                        <OtherFrequency frequency="2600" available="true"/>
                    </OtherFrequencyList>
                </OtherTech>
            </OtherTechList>
        </SupportedTechnologyFrequencies>

Here's the SQL I try to read the XML with
LOAD XML LOCAL INFILE 'd:/c_extract.xml' 
INTO TABLE temp_aa14
 ROWS IDENTIFIED BY '<UTRAN>'
;

If I look for ROWS IDENTIFIED by "<GSM>" all the expected fields are populated OK, but when I look for "<UTRAN>", the F450 field is NULL instead of false.
Same If I look for "<WLAN>". F450 field is NULL.
If I move the F450 field in the XML to the second attribute/value, it's read OK, and the new first attribute is missed.

Any suggestions on how I read this XML file?

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
LOAD XML LOCAL INFILE problem. Missing a field.
May 31, 2015 10:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.