• Resolved Fody

    (@fodisery)


    I’m tring to make xml feed for real estate facebook ads.
    https://developers.facebook.com/docs/marketing-api/real-estate-ads/get-started/

    How to make custom xml where the tag have another tag in it?

    I want to output image urls inside nested tag so it looks like:

    <image><url>{URL_1}</url></image><image><url>{URL_2}</url></image>

    Full example:

    <?xml version="1.0" encoding="UTF-8"?>
    <listings>
    <title>example.com Feed</title>
    <link rel="self" href="http://www.example.com"/>
    <listing>
    <home_listing_id>12345678</home_listing_id>
    <name>1 Hacker Way, Menlo Park, CA 94025</name>
    <availability>for_rent</availability>
    <description>An amazing listing</description>
    <address format="simple">
    <component name="addr1">1 Hacker Way</component>
    <component name="city">Menlo Park</component>
    <component name="region">California</component>
    <component name="country">United States</component>
    <component name="postal_code">94025</component>
    </address>
    <latitude>1.11414</latitude>
    <longitude>-1.835003</longitude>
    <neighborhood>Menlo Oaks</neighborhood>
    <image>
    <url>http://example.com/12345678-1.jpg</url>
    </image>
    <image>
    <url>http://example.com/12345678-2.jpg</url>
    </image>
    <image>
    <url>http://example.com/12345678-3.jpg</url>
    </image>
    <listing_type>for_rent_by_agent</listing_type>
    <num_baths>6</num_baths>
    <num_beds>5</num_beds>
    <num_units>1</num_units>
    <price>110000 USD</price>
    <property_type>house</property_type>
    <url>http://www.example.com/link_to_listing</url>
    <year_built>2007</year_built>
    </listing>
    </listings>

    I tied putting in 1 line but it not smart enough to detect what i want, instead just repeating the url tag inside the image tag:
    <image><url>{Image URL}</url></image>

    I have also tried custom php function but the url tag gets sanitized.

    &lt;url&gt;https://example.com/1.png&lt;/url&gt;

    • This topic was modified 1 year ago by Fody.
    • This topic was modified 1 year ago by Fody.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Nested Tag XML Feed’ is closed to new replies.