module DeleteBlnFromXML where

import HXML

borradoAnt [] = []
borradoAnt (y:ys) | (y=='>' && ys/=[] && ((head ys==' ')||(head ys=='\t')||(head ys=='\n'))) =

			 		borradoAnt (y:(tail ys))

			| (y:ys)==[] = []

			| ys==[] = y:[]

  	            	|otherwise = y:(borradoAnt ys)

borradoPos [] = []
borradoPos (y:ys) 	| (y=='<' && ys/=[] && (head ys<=' ')) =

			 		borradoPos (y:(tail ys))
			| (y=='<' && ys/=[] && (head ys=='/') && (head (tail ys))<=' ') =

			 		borradoPos (y:('/':(tail(tail ys))))
			| (y:ys)==[] = []

			| ys==[] = y:[]

  	            	|otherwise = y:(borradoPos ys)


deleteBlnFromXML a = (reverse.borradoAnt.borradoPos.reverse.borradoAnt.borradoPos) a




formatTree y = case y of
		Tree RTNode ys -> Tree RTNode (map addTics ys)

addTics y = case y of
	      Tree (TXNode x ) n-> Tree (TXNode (''':x++''':[]) ) n
	      Tree (PINode x y) []-> Tree (PINode x y) []
	      Tree (CXNode x ) []-> Tree (CXNode x ) []
	      Tree (ENNode x ) []-> Tree (ENNode x ) []
	      Tree (ELNode x m) []-> Tree (ELNode x m) []
	      Tree (ELNode x m) n -> Tree (ELNode x m) (map addTics n) 	
