By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

XLM prolgoue

P: n/a
How do I go about creating the XML prologue like I want it to be?
Specifically, I am trying to add encoding and some namespace stuff.

Jan 17 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
fscked wrote:
How do I go about creating the XML prologue like I want it to be?
Specifically, I am trying to add encoding and some namespace stuff.
The XML declaration and the DTD that may appear in the prolog are
optional.

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

If your encoding is UTF-8 (or ASCII ...) you don't need an XML
declaration. Otherwise everything depends on the XML lib you
use. For ElementTree, `tostring(elt, "ISO-8859-1")` for example
will automatically include the right declaration at the beginning
of your xml string ...

There is no namespace information inside the prolog. Such
"stuff" may appear inside the root element. Again, RTFM of
your specific XML lib :) For ElementTree, see
http://effbot.org/zone/element.htm#xml-namespaces

Cheers,

SB

Jan 17 '07 #2

P: n/a
fscked schrieb:
How do I go about creating the XML prologue like I want it to be?
print "<?xml version='%s' encoding='%s'?% (version, encoding)

Regards,
Martin
Jan 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.