Web Analytics Made Easy -
StatCounter Simple XML Parsing - CodingForum

Announcement

Collapse
No announcement yet.

Simple XML Parsing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple XML Parsing

    Hey Guys... i very new to parsing XML with php and i'm looking for the best way to do some simple parsing.

    I have the following xml code (this is actually just held in a string, not an actual xml file)..
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <List>
        <ListOrder num="1">
              <Id>546</Id>
              <Value>1</Value>
        </ListOrder>
        <ListOrder num="1">
              <Id>105</Id>
              <Value>2</Value>
        </ListOrder>
        <ListOrder num="2">
              <Id>754</Id>
              <Value>3</Value>
        </ListOrder>
    </List>
    and what i need to do with this code is loop through it and update a database...
    Code:
    Update tblApplications
    SET  ListOrder = ***XML VALUE ***
    WHERE ApplicationID = ***XML ID ***
    are there any suggestions to the best way to go about doing this?

    Thanks,
    ~Jamie

    **EDIT: if it helps any i'm using php 4.4.4
    Last edited by JayStang; Sep 24, 2006, 12:37 AM.

  • #2
    The best way imo is use PHP's built in xml parsing function, xml_parse(). You'll need to create the parser using the xml_parser_create() function.

    Comment


    • #3
      if you have php5, you can use SimpleXML

      http://us3.php.net/simplexml
      eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

      Comment

      Working...
      X