mapping the data xml with fields the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjava
    New Member
    • Sep 2009
    • 132

    mapping the data xml with fields the database

    hi,

    i have this file XML
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <authentication login="MyLog" password="MyPass" />
    <inventoryUpdate hotelId="4">
    <room id="B3T">
    <inventory>
    <availability from="2010-12-28" to="2010-12-28" quantity="1" />
    <availability from="2010-12-29" to="2010-12-31" quantity="1" />
    <availability from="2011-01-01" to="2011-01-01" quantity="1" />
    <availability from="2011-01-02" to="2011-03-31" quantity="1" />
    <availability from="2011-04-01" to="2011-12-30" quantity="1" />
    </inventory>
    <rate currency="EUR" rateCode="BAR" rateName="Best Available Rate">
    <planning from="2010-12-28" to="2010-12-28" minimumStay="1" unitPrice="210"
    noArrival="false" isClosed="false" />
    <planning from="2010-12-29" to="2010-12-31" minimumStay="1" unitPrice="273"
    noArrival="false" isClosed="false" />
    <planning from="2011-01-01" to="2011-01-01" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    <planning from="2011-01-02" to="2011-03-31" minimumStay="1" unitPrice="294"
    noArrival="false" isClosed="false" />
    Confidential – Copyright SIRIONA 2008 - 16 novembre 2012
    Chapter : Receiving inventory updates
    9
    <planning from="2011-04-01" to="2011-12-30" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    </rate>
    <rate currency="EUR" rateCode="PACKAGE1" rateName="Package Offer">
    <planning from="2010-12-28" to="2010-12-28" minimumStay="1"
    unitPrice="380.0000" noArrival="false" isClosed="false" />
    <planning from="2010-12-29" to="2010-12-31" minimumStay="1"
    unitPrice="380.0000" noArrival="false" isClosed="false" />
    <planning from="2011-01-01" to="2011-01-01" minimumStay="1" unitPrice="357"
    noArrival="false" isClosed="false" />
    <planning from="2011-01-02" to="2011-03-31" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    <planning from="2011-04-01" to="2011-12-30" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    </rate>
    <rate currency="EUR" rateCode="RACKPRI" rateName="Public Price">>
    <planning from="2010-12-28" to="2010-12-28" minimumStay="1"
    unitPrice="380.0000" noArrival="false" isClosed="false" />
    <planning from="2010-12-29" to="2010-12-31" minimumStay="1"
    unitPrice="380.0000" noArrival="false" isClosed="false" />
    <planning from="2011-01-01" to="2011-01-01" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    <planning from="2011-01-02" to="2011-03-31" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    <planning from="2011-04-01" to="2011-12-30" minimumStay="1"
    unitPrice="340.0000" noArrival="false" isClosed="false" />
    </rate>
    </room>
    </inventoryUpdate>
    </message>
    how can i read this file XML and mapping to store in data base

    Thanks in advance
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    for reading XML you can use SimpleXML and DOMDocument. the mapper you have to write on your own, though.

    Comment

    Working...