• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Removing extra blank lines from generated html?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing extra blank lines from generated html?


  • Subject: Re: Removing extra blank lines from generated html?
  • From: Mike Schrag <email@hidden>
  • Date: Fri, 18 Apr 2008 18:24:48 -0400

How extreme do you want to get? You can work some wonders with your HTML in dispatchRequest

Personally, I find that this generates the cleanest possible response:

public WOResponse dispatchReqcuest( WORequest request ) {
WOResponse respone = super.dispatchRequest( request );
response.setContent( "" );
return response;
}
I experimented last year with running output through tidy, but it ends up breaking all kinds of things (tidy is just too strict for most HTML):

  public WOResponse dispatchRequest(WORequest request) {
    WOResponse response = super.dispatchRequest(request);

    if (MDTApplication.contentTypeHTML(response)) {
      ByteArrayInputStream in = response.content().stream();
      ERXRefByteArrayOutputStream out = new ERXRefByteArrayOutputStream();
      tidy().parseDOM(in, out);
      response.setContent(out.toNSData());
    }

    return response;
  }

Possibly exporting the formatter from WOLips to an external jar might give better results because it's designed to be very forgiving about how it interprets your HTML, but in the scheme of things, this is probably not worth the effort.

ms
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Removing extra blank lines from generated html?
      • From: Hugi Þórðarson <email@hidden>
References: 
 >Removing extra blank lines from generated html? (From: Alan Zebchuk <email@hidden>)
 >Re: Removing extra blank lines from generated html? (From: "John Huss" <email@hidden>)
 >Re: Removing extra blank lines from generated html? (From: Hugi Þórðarson <email@hidden>)

  • Prev by Date: Re: Removing extra blank lines from generated html?
  • Next by Date: Re: Removing extra blank lines from generated html?
  • Previous by thread: Re: Removing extra blank lines from generated html?
  • Next by thread: Re: Removing extra blank lines from generated html?
  • Index(es):
    • Date
    • Thread