Click here to Skip to main content
15,877,574 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Executing PHP script without leaving the page PinPopular
enhzflep3-May-11 6:39
enhzflep3-May-11 6:39 
QuestionTo use or not to use Pin
astra.20123-May-11 0:10
astra.20123-May-11 0:10 
QuestionPHP Form help Pin
Dave McCool30-Apr-11 8:54
Dave McCool30-Apr-11 8:54 
AnswerRe: PHP Form help Pin
Peter_in_27801-May-11 4:59
professionalPeter_in_27801-May-11 4:59 
GeneralRe: PHP Form help Pin
Dave McCool1-May-11 5:08
Dave McCool1-May-11 5:08 
Questionthe apache service doesn't start Pin
Farhaneh25-Apr-11 20:10
Farhaneh25-Apr-11 20:10 
AnswerRe: the apache service doesn't start Pin
Gerben Jongerius25-Apr-11 20:41
Gerben Jongerius25-Apr-11 20:41 
QuestionAn XML printer thingy Pin
freeluna22-Apr-11 14:23
professionalfreeluna22-Apr-11 14:23 
Hi All -

After shaking my head with the output of xml.Elementry(root).write(fp), which dumps the entire XML tree structure onto one line, I started doing some research. I checked out prettyprint from effbot.org, which sort of inspired me to write the following.. It handles stand alone XML tags and XML tag pairs, attributes, tag text and tag tails. I hope people find it useful...

import xml.etree.ElementTree as xml


def DumpXMLElem(e,deep=0):
    noneg = 0

    # indent the tag according to the depth in the element tree.

    for i in range(0,deep):
        print '   ',

    # find out if the elment has children or a text field, if so
    # this is part of a tag-pair, otherwise it's a single stand-
    # alone tag.

    c = e.getchildren()
    
    # print the beginning of the open tag
    print '<'+e.tag,

    # print the tag attributes within the opening tag
    for i in e.attrib:
        print ' '+i+"="+e.attrib[i],
    
    # if this is a stand-alone tag (no children and no text)
    # print out the proper tag terminator
 
    if(len(c)==0 and e.text==None):
        print '/>',

        # print the tail, if supplied
        if(e.tail):
            print e.tail
        print ' '
        noneg=1    # flag to avoid printing the closing tag
    else:
        # this is part of a tag pair
        print '>',

    # print the tag's text, usually that stuff between the opening and closing tag.
    if(e.text):
        print e.text,
    # if the element has children, end this line and go process the children.
    if(len(c)>0):
        print ' '
        for s in c:
            DumpXMLElem(s,deep+1)
        # back from dealing with the kids, go line-up the ending tag with the 
        # same indent as the opening tag.
        for i in range(0,deep):
            print '   ',
    # print that ending tag, and any tail that the element had...
    if(noneg==0):
        print '</'+e.tag+'>',
        if(e.tail):
            print e.tail
        print ' '

QuestionClosing a window with button?? Pin
AmbiguousName21-Apr-11 6:00
AmbiguousName21-Apr-11 6:00 
AnswerRe: Closing a window with button?? Pin
Ali Al Omairi(Abu AlHassan)21-Apr-11 15:21
professionalAli Al Omairi(Abu AlHassan)21-Apr-11 15:21 
AnswerRe: Closing a window with button?? Pin
enhzflep3-May-11 6:53
enhzflep3-May-11 6:53 
QuestionHow to open Perl files / Perl Module files in Design Layout Pin
sr15920-Apr-11 19:04
sr15920-Apr-11 19:04 
QuestionFuzzy C Means in PHP Code and My SQL Database, Please Help! Pin
edrianhadinatazz18-Apr-11 19:35
edrianhadinatazz18-Apr-11 19:35 
AnswerRe: Fuzzy C Means in PHP Code and My SQL Database, Please Help! Pin
edrianhadinatazz18-Apr-11 19:38
edrianhadinatazz18-Apr-11 19:38 
GeneralRe: Fuzzy C Means in PHP Code and My SQL Database, Please Help! Pin
User 171649218-Apr-11 22:07
professionalUser 171649218-Apr-11 22:07 
GeneralRe: Fuzzy C Means in PHP Code and My SQL Database, Please Help! Pin
Smithers-Jones19-Apr-11 1:53
Smithers-Jones19-Apr-11 1:53 
GeneralRe: Fuzzy C Means in PHP Code and My SQL Database, Please Help! Pin
edrianhadinatazz28-Apr-11 17:31
edrianhadinatazz28-Apr-11 17:31 
Questioncheckboxes from hell Pin
Joan M13-Apr-11 4:24
professionalJoan M13-Apr-11 4:24 
AnswerRe: checkboxes from hell Pin
Graham Breach13-Apr-11 5:32
Graham Breach13-Apr-11 5:32 
GeneralRe: checkboxes from hell Pin
Joan M13-Apr-11 5:48
professionalJoan M13-Apr-11 5:48 
AnswerRe: checkboxes from hell Pin
Luc Pattyn13-Apr-11 6:11
sitebuilderLuc Pattyn13-Apr-11 6:11 
GeneralRe: checkboxes from hell Pin
Joan M13-Apr-11 6:33
professionalJoan M13-Apr-11 6:33 
Questionphp and div tags Pin
komanche12-Apr-11 23:52
komanche12-Apr-11 23:52 
AnswerRe: php and div tags Pin
enhzflep13-Apr-11 3:45
enhzflep13-Apr-11 3:45 
AnswerRe: php and div tags Pin
Mutinda Boniface15-Apr-11 3:44
Mutinda Boniface15-Apr-11 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.