From: <ast...@gm...> - 2007-06-29 03:32:04
|
For starters, try '<tag>string</tag><tag>string</tag>'.replace('><'', '>\n<') On 6/29/07, Moore, Greg <Gre...@ad...> wrote: > > A script that I'm writing gets a string back from a server. This string > happens to be xml and it can be quite lengthy (usually <2K). What I'd > like is something that would reflow/reformat this so it stayed a string > (or even a list) so this it would turn, the example below: (which really > is all one string.) > > <Inquiry > Refdata="test"><DataType>Inquiry</DataType><Client><RefNum>9999969123961 > 856770WCZ</RefNum></Client></Inquiry> > > Info something that was properly formatted and indented. Like this: > > <Inquiry refdata="test"> > <someTag> > <DataType>Inquiry</DataType> > <Client> > <RefNum>9999969123961856770WCZ</RefNum> > </Client> > </sometag> > </Inquiry> > > It doesn't need to be a sax, dom, or element tree structure. Nothing is > going to be done with this text except for being displayed and maybe > printed. > > Any pointers, suggestions or code would be most appreciated. > > Thanks in Advance, > Greg W. Moore > ADP, Inc. > > > > This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |