SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question A quick question on XML_Serializer

    Does anybody here have any experience with XML_Serializer?

    I'm sure there must be one or two

    I'm parsing an XML file with XML_Serializer.

    I'm using this PEAR class so that I can grab the entire contents and put it into an array (why is another story for another time)

    At the moment it is also taking the attributes and their values of the tags like so:

    Code:
        <prod id="88966064" pre_order="no" web_offer="no" in_stock="no" stock_quantity="0">
        <pId>608</pId>
        <isbn>0000000000000</isbn>
    And adding them to the returned array like this:

    Code:
    XML_Serializer_Tag] => Array(
                 [id] => 88966064
                 [pre_order] => no
                 [web_offer] => no
                 [in_stock] => no
                 [stock_quantity] => 0
    )
    Are there any options in XML_Serializer that allows me to use the XML data without the attributes and just the tags and the data inbetween them, ie only?

    HTML Code:
        <pId>608</pId>
        <isbn>0000000000000</isbn>
    Let everyday be Christmas

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    $str = preg_replace("~<([^\s>]*)[^>]*>~","<$1>",$str);
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Tags for this Thread

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
  •