+ Reply to Thread
Results 1 to 5 of 5

Thread: Query on XML document

  1. #1
    Newbie amberlong83 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    3

    Query on XML document

    Hi friends

    I am working with PHP5 and have a requirement to select xml node on the base of parameter. My xml contains the list of country and it has child node of state list. Like this

    HTML Code:
    <?xml version="1.0" encoding="utf-8"?>
    <country_list>
    	<country id="US">
    		<state>NY</state>
    		<state>CA</state>
    		<state>NJ</state>		
    	</country>
    	<country id="AU">
    		<state>New South Wales</state>		
    		<state>Victoria</state>				
    		<state>Queensland</state>						
    	</country>	
    </country_list>
    I want to get the xml like

    HTML Code:
    <country id="AU">
    		<state>New South Wales</state>		
    		<state>Victoria</state>				
    		<state>Queensland</state>						
    	</country>
    Can anyone help me how can I achieve this?

    thanks in advance.

  2. #2
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,556
    Blog Entries
    97

    Re: Query on XML document

    Moved to the PHP Forum.

    You should use SimpleXML to read your XML document. It makes extracting values very easy.

  3. #3
    Newbie umapathyphp is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    1

    Re: Query on XML document

    Hi jordan,

    Could u refer a sample code for this . I too in need of this

  4. #4
    Administrator Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan is a name known to all Jordan's Avatar
    Join Date
    Nov 2005
    Location
    Hendersonville, NC
    Posts
    24,556
    Blog Entries
    97

    Re: Query on XML document

    Sure, the best place to go is the manual: PHP: SimpleXML - Manual

  5. #5
    Newbie amberlong83 is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    3

    Re: Query on XML document

    thanks for reply

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 18
    Last Post: 06-01-2009, 09:05 PM
  2. array_slice vs. extra query
    By BASHERS33 in forum PHP Forum
    Replies: 10
    Last Post: 04-22-2009, 07:25 PM
  3. Best tools to build Document Generator?
    By wildkick in forum General Programming
    Replies: 3
    Last Post: 01-13-2009, 01:53 PM
  4. UNIX HELP: C programmers
    By Dr. Abbey in forum MarketPlace
    Replies: 5
    Last Post: 05-26-2008, 11:57 AM
  5. Whats wrong with my query!!!
    By Saint in forum Database & Database Programming
    Replies: 2
    Last Post: 10-22-2006, 06:09 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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