Re: Read/Write file, break lines at 256 (or more) but NOT elements

Michael Ludwig <[email protected]> Fri, 18 Mar 2011 21:47:09 +0100
Newsgroups gmane.comp.lang.perl.xml
Message-ID <20110318204709.GG1936@wladimir>
Charlie Hanpru schrieb am 17.03.2011 um 08:55 (-0400):
>  
> I have Perl script that reads in a xml file. Adds carriage returns in
> fron of specific elements then write the results to a TMP file. The
> problem I am having is if there is a tag with multiple attributes it
> will get broken in the middle which I can't have. How do I break the
> lines at 256 characters (or more) but NOT a tag?

You're using a non-XML tool (Text::Wrap) to process XML.

To achieve what you want, use XSLT (@strip-space and @indent set), call
it from a Perl script where you register a hook to process the text
nodes and apply the formatting you want.

-- 
Michael Ludwig
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs