0

I need to load an XML file into a MySQL database. I also need to load the XML file for a SQLite database but I do not know how to do it.

<CommunicationLog xmlns="http://knx.org/xml/telegrams/01">
  <RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
  <Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
  <Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
  <RecordStart Timestamp="" Mode="" Host="" ConnectionName="" ConnectionOptions="" ConnectorType="" MediumType="" />
  <Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
  <Telegram Timestamp="" Service="" FrameFormat="" RawData="" />
  <RecordStop Timestamp="" />
</CommunicationLog>
  • What have you done so far? What approaches have you considered? And in what way do you want to store the XML? Do you mean you want to store the entire XML in the DB? Or particular values? – Steve Oct 26 '17 at 10:04
  • @Steve I have an XML file with several tags and ID, I simply need to load that file into SQL as it is. It's for a class exercise. Thank you very much. – Patricia Diaz Serrano Oct 26 '17 at 10:11
  • 2
    Show us the XML. Point out the bits that you want storing, and what the DB schema looks like. – Steve Oct 26 '17 at 10:16
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Oct 26 '17 at 10:26
  • 1
    Do you wish to do this programmatically, or just once only? If the latter, install phpMyAdmin or MySQL Workbench. – halfer Oct 26 '17 at 10:27
  • @Steve Above I have published the code above that I need to enter in MySQL and SQLite – Patricia Diaz Serrano Oct 26 '17 at 10:28
  • 1
    You probably don't wish to store this "as is" - putting an XML string in a single column value is not as useful as splitting it up. Let us know how XML attributes should map to table(s) columns. – halfer Oct 26 '17 at 10:30
  • 1
    Here is an example of a similar question, like this asker you need to be more specific about how you want to go about this and what you already tried: https://stackoverflow.com/questions/5491056/how-to-import-xml-file-into-mysql-database-table-using-xml-load-function – SpacemanSpiff Oct 26 '17 at 10:35
  • I'm assuing the OP doesn't know what the schema should look like, doesn't know what the mapping is and hasn't tried anything themselves. Therefore I'm flagging as too broad. – Steve Oct 26 '17 at 10:42

0 Answers0