Python code examples that _generate_ HTML/XML? 
Author Message
 Python code examples that _generate_ HTML/XML?

I'm creating an app for use in-house, that will assist a user (complete
novice) in creating web pages.  So after they complete a session I will need
to take their "instructions" and generate the items necessary to display the
desired pages in a browser.  Therefore I'll be creating the HTML/XML tags
and code dynamically for things like list boxes, buttons, hrefs, graphics,
etc.  Has anybody seen any code samples or URL's for such that show how to
do this in Python?  Are there parts of the Zope source code that might be
helpful to look at, if so what 'py' files?

thx



Tue, 05 Apr 2005 04:29:20 GMT  
 Python code examples that _generate_ HTML/XML?

Quote:
> Has anybody seen any code samples or URL's for such that show how to
> do this in Python?

Take a look at http://www.autorunning.com/arpyexe.cgi  There is a working
code sample in the window.  Press "Create EXE" and that code is wrapped into
an executable which runs on Windows computer, whether python is installed or
not.

--

Dennis Reinhardt


http://www.dair.com



Tue, 05 Apr 2005 05:30:34 GMT  
 Python code examples that _generate_ HTML/XML?
Alle 22:29, gioved 17 ottobre 2002, hai scritto:

Quote:
> I'm creating an app for use in-house, that will assist a user (complete
> novice) in creating web pages.  So after they complete a session I will
> need to take their "instructions" and generate the items necessary to
> display the desired pages in a browser.  Therefore I'll be creating the
> HTML/XML tags and code dynamically for things like list boxes, buttons,
> hrefs, graphics, etc.  Has anybody seen any code samples or URL's for such
> that show how to do this in Python?  Are there parts of the Zope source
> code that might be helpful to look at, if so what 'py' files?

> thx

Robert, if you just have to generate HTML tags (code) from within a Python
program, you can take advantage of the HTMLGen library by Robin
Friedrichs. You can find it at:

http://starship.python.net/crew/friedrich/HTMLgen/html/main.html

and:

http://www.zenspider.com/Languages/Python/HTMLGen.html

That is not the only one: I think you can find a large collection of tools
like HTMLGen at the "Vaults of Parnassus "web site (see the python main web
site fot the link) and at other python-devoted sites on the web. Try "HTML"
and "Python" from Google or Yahoo, as well.

Of course, you can just print HTML code to the standard output, or any other
file, with a simple "print" instruction, as well.

For example:
print "<h1>My Title</h1>"

or:

content = "The world"
initag = "<h1>"
endtag = "</h1>"
output = initag + content + " is not enough "+endtag
print output

(check the python manual for the characters of your text and of your tags
that need to be backslashed prior of printing, most likely "\", "/" and "<",
">" )

---------------------
Alessandro Bottoni



Tue, 05 Apr 2005 15:58:06 GMT  
 Python code examples that _generate_ HTML/XML?

Quote:

>I'm creating an app for use in-house, that will assist a user (complete
>novice) in creating web pages.  So after they complete a session I will need
>to take their "instructions" and generate the items necessary to display the
>desired pages in a browser.  Therefore I'll be creating the HTML/XML tags
>and code dynamically for things like list boxes, buttons, hrefs, graphics,
>etc.  Has anybody seen any code samples or URL's for such that show how to
>do this in Python?  Are there parts of the Zope source code that might be
>helpful to look at, if so what 'py' files?

Have you looked at
   http://www.python.org/doc/current/lib/module-xml.dom.html
?

Regards,
Bengt Richter



Wed, 06 Apr 2005 03:03:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Example of Python code (C code to Python code)

2. Open generated HTML in browser (was - Generate HTML in GUI app)

3. HTML Generating Code Not Pretty / Hard to Read

4. XML-code examples

5. Compile HTML/XML into a python object??

6. emitting HTML and XML in Python

7. Using Python to generate HTML

8. may any one post an example for xml which use method appendchild(xml)

9. Examples of using XML and Python?

10. Examples of using XML and Python? (fwd)

11. Examples of HTML Processing applications / code?

12. Python XML parsing example

 

 
Powered by phpBB® Forum Software