XML : Get values from XML files in MySQL

  <?xml version="1.0"?>  <!DOCTYPE HWINFO SYSTEM "HWiNFO32log.dtd">      <HWINFO>          <COMPUTER>              <NodeName>Name</NodeName>              <Property>                  <Entry>Computer Name</Entry>                  <Description>PCName</Description>              </Property>              <Property>                  <Entry>Computer Brand Name</Entry>                  <Description>Motherboard</Description>              </Property>              <Property>                  <Entry>Operating System</Entry>                  <Description>WinOS</Description>              </Property>              <Property>                  <Entry>Service Pack</Entry>                  <Description>SP1</Description>              </Property>              <SubNodes>                            <CPU>                      <NodeName>Central Processor(s)</NodeName>                      <Property>                          <Entry>Number Of Processor Packages (Physical)</Entry>                          <Description>1</Description>                          <PropertyType>CPU_COUNT</PropertyType>                      </Property>                      <Property>                          <Entry>Number Of Processors Cores</Entry>                          <Description>4</Description>                          <PropertyType>CPU_COUNT</PropertyType>                      </Property>                      <Property>                          <Entry>Number Of Logical Processors</Entry>                          <Description>8</Description>                      </Property>                      <SubNode>                          <NodeName>Intel Core i7-4770S</NodeName>                          <Property>                              <Entry>Processor Name</Entry>                              <Description>Intel Core i7-4770S</Description>                              <PropertyType>CPU_NAME</PropertyType>                          </Property>                          <Property>                              <Entry>Original Processor Frequency</Entry>                              <Description>3100.0 MHz</Description>                          </Property>                          <Property>                              <Entry>Original Processor Frequency [MHz]</Entry>                              <Description>3100</Description>                              <PropertyType>CPU_SPEED</PropertyType>                          </Property>                          <Property>                              <Entry>CPU Platform</Entry>                              <Description><SubNodes></Description>                          </Property>                      </SubNode>                  </SubNodes>              </CPU>          </COMPUTER>      </HWINFO>    

This is my XML file, in which I have some values. Under "" I have not only CPU, but there is more - MOBO, VIDEO, etc. Problem is that, I want to get out from this information and insert into my database. For example -> -> -> -> CPU Platform, value: "Socket H3 (LGA1150)". I tried to look for solution, but I think my keywords was a bit wrong and this XML structure sucks a bit or.. ? And main question is: how to learn or give MySQL path to read these exact values? Or there is another way to get full system report from PC and load data in database? About database: It has 8 tables before mentioned and others. Main table, where is all information and all another tables have specifiec information for system specification - CPU, motherbord, sound etc. Main table have foreign keys from these tables. I hope that my idea is understandable.

No comments:

Post a Comment