Kaitlyn
Kaitlyn

Reputation: 3

xml linked to HTML div

This is new to me altogether. I have a .xml file that I am trying to display the info in an HTML file in div rather than a table. What is the best route to go about doing this? If needed this will be for a job listing area on a site. I have provided an example from the .xml file and am looking for the title, description/location, date, and link to be displayed in the div provided in the HTML where it currently is, but update automatically as the .xml file is updated.

<?xml version="1.0"?>
<rss version="2.0">
    <channel>
          <item>
                <title><![CDATA[Family Medicine Physician]]></title>
                <link><![CDATA[display-job/201/Family-Medicine-Physician.html]]></link>
                <description>
                    <![CDATA[Syracuse, NY

                    Our outpatient, primary care office has a new 
                    opportunity for a Family Medicine Physician.
            </description>
            <pubDate>Tue, 11 Jul 2017 12:47:07 GMT</pubDate>
            <guid><![CDATA[display-job/201/Family-Medicine-Physician.html]]></guid>
        </item>

HTML:

<!-- Start of Single Job Post 2 -->
                <div class="single-job-post row nomargin">
                    <!-- Job Company -->


                    <!-- Job Title & Info -->
                    <div class="col-md-8 col-xs-6 ptb20">
                        <div class="job-title">
                            <a href="JobPost.html">Family Medicine Physician</a>
                        </div>

                        <div class="job-info">
                            <span class="company"><i class="fa fa-building-o"></i>Date</span>
                            <span class="location"><i class="fa fa-map-marker"></i>Syracuse, NY</span>
                        </div>
                    </div>

                    <!-- Job Category -->
                    <div class="col-md-2 col-xs-3 ptb30">
                        <div class="job-category">
                            <a href="display-job/194/Family-Medicine-Physician.html?searchId=1497985283.27&page=1" class="btn btn-green btn-small btn-effect">View Job</a>
                        </div>
                    </div>
                </div>
                <!-- End of Single Job Post 2 -->

Please let me know any more infromaion, again Im new to this, but learning.

Upvotes: 0

Views: 60

Answers (1)

abhndv
abhndv

Reputation: 209

You can display as you needed by using PHP. Use the function simplexml_load_file("file.xml") for this.

Try this tutorial

Hope this helps..

Upvotes: 1

Related Questions