Results 1 to 2 of 2

Thread: writing to xml using php

  1. #1
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default writing to xml using php

    Hello Friends....

    My name is Adil Farid... I am new to XML


    I am trying to add element to xml , but i am not able to add its attribute.. as well..

    Creting new element in xml and appending its siblings is simple but i am not getting any idea, how to set attributes to the xml element that has been created....

    i am pasting my xml code,,,\\

    <?xml version="1.0" encoding="utf-8"?>
    <photos path="images/">
    <photo name="Photo 1" url="1.jpg">This is the optional description for photo 1</photo>
    <photo name="Photo 2" url="2.jpg">This is the optional description for photo 2</photo>
    <photo name="Photo 3" url="3.jpg">This is the optional description for photo 3</photo>
    <photo name="Photo 4" url="4.jpg">This is the optional description for photo 4</photo>
    <photo name="Photo 5" url="5.jpg">This is the optional description for photo 5</photo>
    </photos>


    Well i am able to create element "Photos" and its sub node "Photo" but adding attributes ot "Photos" and "Photo " is very hard for me...\

    hope to see the solution soon.......

    Thanks in Advance....

    Regards.
    Adil Farid.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    How are you outputting the above? We'll need to see the PHP script that you're using to accomplish what you've done so far. It's hard to know how to help without knowing what's going on first.

    So, please post the relevant PHP and someone might be able to help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •