<?standalone yes?>
Peter Hansen
peter at engcorp.com
Tue Sep 23 09:22:21 EDT 2003
"Lonnie, SRC employee" wrote:
>
> *** post for FREE via your newsreader at post.newsfeed.com ***
>
> I can figure out how to set the standalone attribute in the <? xml
> version="1.0 ?> tag eg <?xml version="1.0" standalone="yes" ?>
Simplest approach might be to manually munge the <?xml ?> tag
as you write the output to a file. You could do a simple re.sub()
or something like this, which we've used from time to time with no
ill effects to date (pseudo-code, not executable as-is):
xml = '<?xml version="1.0"?><doc><somestuff/></doc>'
xmlEnd = xml.find('?>') + 2
file.write('<?xml standalone="yes" version="1.0"?>' + xml[xmlEnd:])
In other words, find the end of the original <?xml?> tag, strip it,
substitute your own, continue on with life.
Simplest thing that could possibly work...
-Peter
More information about the Python-list
mailing list