Results 1 to 3 of 3

Thread: Remove sub-tags in PHP / XML

  1. #1
    Join Date
    Apr 2009
    Posts
    107

    Remove sub-tags in PHP / XML

    hi
    i am working on php as my college assignment project now here i want do know how i can delete sub-tags in PHP / XML .i am not able to get it so please tell me how to do it ? thank you.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Remove sub-tags in PHP / XML

    How to remove/Strip HTML tags from php $_POST variable:

    foreach ($_POST as $key => $value) {
    $_POST[$key] = addslashes(strip_tags($value));
    }
    foreach ($_GET as $key => $value) {
    $_GET[$key] = addslashes(strip_tags($value));
    }
    1. strip_tags - tries to return a string with all HTML and PHP tags stripped from a given string. HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tags
    2. addslashes - Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote (’), double quote (”), backslash (\) and NUL (the NULL byte). It essentially runs addslashes() or mysql_real_escape_string() on all GET, POST, and COOKIE data.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Remove sub-tags in PHP / XML

    Using the DOM API with PHP in a stream or XML document, it may happen that one I need to delete all sub-tags, all elements, all the nodes of a tag, for example:
    <? xml version = "1.0" encoding = "UTF-8"?>
    <config>
    <tag>
    <under-tag name = "1"> Sue </ sub-tag> <! - to delete ->
    <under-tag name = "2"> Benedict </ sub-tag> <! - to delete ->
    <under-tag name = "3"> Camille </ sub-tag> <! - to delete ->
    <under-tag = "4" name> David </ sub-tag> <! - to delete ->
    </ tag>
    </ config>
    It's simple, provided they do not take the wrong path from the start. Indeed, one might think that for every element of our tag, delete that item. Thus it induces the use of a foreach in the well manner

Similar Threads

  1. How to remove information tags over the tab
    By Raj Desai in forum Technology & Internet
    Replies: 7
    Last Post: 27-02-2012, 03:20 PM
  2. How to remove HTML tags from Excel Sheet
    By Jaques Strapp in forum MS Office Support
    Replies: 3
    Last Post: 25-01-2012, 07:50 PM
  3. How to remove smart tags from PowerPoint?
    By Gokul20 in forum Windows Software
    Replies: 5
    Last Post: 10-03-2010, 10:36 PM
  4. Unable to remove smart tags from Excel
    By GurdeepS in forum Windows Software
    Replies: 4
    Last Post: 25-02-2010, 09:13 AM
  5. How to remove smart tags in MS word?
    By Ram Bharose in forum Windows Software
    Replies: 5
    Last Post: 22-01-2010, 11:43 AM

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
  •  
Page generated in 1,714,021,355.62931 seconds with 16 queries