Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Remove sub-tags in PHP / XML

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-04-2009
Members
 
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.

Reply With Quote
  #2  
Old 29-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Remove sub-tags in PHP / XML

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

Quote:
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.
Reply With Quote
  #3  
Old 29-04-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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:
Quote:
<? 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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Remove sub-tags in PHP / XML"
Thread Thread Starter Forum Replies Last Post
How to remove information tags over the tab Raj Desai Technology & Internet 7 27-02-2012 03:20 PM
How to remove HTML tags from Excel Sheet Jaques Strapp MS Office Support 3 25-01-2012 07:50 PM
How to remove smart tags from PowerPoint? Gokul20 Windows Software 5 10-03-2010 10:36 PM
Unable to remove smart tags from Excel GurdeepS Windows Software 4 25-02-2010 09:13 AM
How to remove smart tags in MS word? Ram Bharose Windows Software 5 22-01-2010 11:43 AM


All times are GMT +5.5. The time now is 07:14 AM.