XHTML Validation and revised page re-writing

7 views
Skip to first unread message

David Pollak

unread,
Aug 26, 2009, 7:27:04 PM8/26/09
to liftweb
Folks,

I've made some significant revisions to a number of aspects of Lift:
  • I condensed two of the rewrite phases into one (the header/tail rewrite and the URL rewriting) and improved the efficiency of the former.  The net effect is that the lift:when attribute is no longer on comet components.
  • I changed comet components to be surrounded by <div> instead of <span> tags.  This allows for nesting of form elements and other block-level elements in comet components.  This may cause some minor layout differences for comet components.
  • In development mode, the rendered page is validated against XHTML Transitional by default and if there are issues, a red box will appear at the bottom of the page outlining the problems
To disable validation: LiftRules.xhtmlValidator = Empty
To enable Strict validation: LiftRules.xhtmlValidator = Full(StrictXHTML1_0Validator)

Please let me know if there are any strange things that happen to page rendering.

Thanks,

David

--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Justin Reardon

unread,
Aug 26, 2009, 8:17:05 PM8/26/09
to Lift
After updating, attempting to load any page results in the error
message below. Given the message, I'm guessing this isn't the fault of
my own code? Turning off validation as recommended causes the page to
load normally again.

The error:
Exception occured while processing /index
Message: org.xml.sax.SAXParseException: InvalidRegex: Pattern value '[-
+]?(\d+|\d+(\.\d+)?%)' is not a valid regular expression. The reported
error was: ''-' is an invalid character range. Write '\-'.'.

com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException
(ErrorHandlerWrapper.java:236)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error
(ErrorHandlerWrapper.java:172)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError
(XMLErrorReporter.java:382)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError
(XSDHandler.java:2241)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.reportSchemaError
(XSDAbstractTraverser.java:612)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseSimpleTypeDecl
(XSDSimpleTypeTraverser.java:390)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseGlobal
(XSDSimpleTypeTraverser.java:140)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSchemas
(XSDHandler.java:1090)

com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema
(XSDHandler.java:481)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema
(XMLSchemaLoader.java:556)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar
(XMLSchemaLoader.java:523)

com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema
(SchemaFactoryImpl.java:206)
javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489)
javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:521)
net.liftweb.http.GenericValidtor.schema(LiftRules.scala:1116)
net.liftweb.http.GenericValidtor.apply(LiftRules.scala:1119)
net.liftweb.http.GenericValidtor.apply(LiftRules.scala:1101)
net.liftweb.http.LiftSession$$anonfun$8.apply(LiftSession.scala:607)
net.liftweb.http.LiftSession$$anonfun$8.apply(LiftSession.scala:607)
scala.List.flatMap(List.scala:1132)
net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$$merge
(LiftSession.scala:607)
net.liftweb.http.LiftSession$$anonfun$10$$anonfun$apply$30.apply
(LiftSession.scala:717)
net.liftweb.http.LiftSession$$anonfun$10$$anonfun$apply$30.apply
(LiftSession.scala:714)
net.liftweb.util.EmptyBox.or(Box.scala:374)
net.liftweb.http.LiftSession$$anonfun$10.apply(LiftSession.scala:711)
net.liftweb.http.LiftSession$$anonfun$10.apply(LiftSession.scala:704)
net.liftweb.util.EmptyBox.or(Box.scala:374)
net.liftweb.http.LiftSession.processRequest(LiftSession.scala:704)
net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
$dispatchStatefulRequest(LiftServlet.scala:229)
net.liftweb.http.LiftServlet$$anonfun$2.apply(LiftServlet.scala:146)
net.liftweb.http.LiftServlet$$anonfun$2.apply(LiftServlet.scala:146)
net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:911)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$
$anonfun$apply$19.apply(S.scala:1051)
net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:848)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$doAround$1.apply
(S.scala:849)
net.liftweb.mapper.DB$$anon$1.net$liftweb$mapper$DB$$anon$$doWith
(DB.scala:119)
net.liftweb.mapper.DB$$anon$1$$anonfun$net$liftweb$mapper$DB$$anon$
$doWith$1.apply(DB.scala:120)
net.liftweb.mapper.DB$$anon$1$$anonfun$net$liftweb$mapper$DB$$anon$
$doWith$1.apply(DB.scala:120)
net.liftweb.mapper.DB$.use(DB.scala:322)
net.liftweb.mapper.DB$$anon$1.net$liftweb$mapper$DB$$anon$$doWith
(DB.scala:120)
net.liftweb.mapper.DB$$anon$1.apply(DB.scala:126)
net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:849)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit
$1.apply(S.scala:1049)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala:1048)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22$$anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$
$anonfun$apply$26$$anonfun$apply$27.apply(S.scala:1069)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22$$anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$
$anonfun$apply$26.apply(S.scala:1068)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22$$anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25.apply
(S.scala:1067)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22$$anonfun$apply$23$$anonfun$apply$24.apply(S.scala:1066)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22$$anonfun$apply$23.apply(S.scala:1065)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$$anonfun
$apply$22.apply(S.scala:1064)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1.apply
(S.scala:1063)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$.net$liftweb$http$S$$_innerInit(S.scala:1062)
net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun$apply
$31$$anonfun$apply$32$$anonfun$apply$33.apply(S.scala:1093)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun$apply
$31$$anonfun$apply$32.apply(S.scala:1092)
net.liftweb.http.RequestVarHandler$.apply(Vars.scala:206)
net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun$apply
$31.apply(S.scala:1091)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30.apply(S.scala:
1090)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$$anonfun$_init$1.apply(S.scala:1089)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$._init(S.scala:1088)
net.liftweb.http.S$.init(S.scala:782)
net.liftweb.http.LiftServlet.doService(LiftServlet.scala:145)
net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply
(LiftServlet.scala:75)
net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply
(LiftServlet.scala:75)
net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
net.liftweb.util.TimeHelpers$class.logTime(TimeHelpers.scala:250)
net.liftweb.util.Helpers$.logTime(Helpers.scala:29)
net.liftweb.http.LiftServlet.doIt$1(LiftServlet.scala:74)
net.liftweb.http.LiftServlet.service(LiftServlet.scala:79)
net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
(HTTPProvider.scala:54)
net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
(HTTPProvider.scala:54)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.URLRewriter$.doWith(Req.scala:465)
net.liftweb.http.provider.HTTPProvider$class.service
(HTTPProvider.scala:53)
net.liftweb.http.LiftFilter.service(LiftServlet.scala:481)
net.liftweb.http.provider.servlet.ServletFilterProvider
$class.protected$service(ServletFilterProvider.scala:41)
net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala:481)
net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun
$doFilter$1.apply(ServletFilterProvider.scala:41)
net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun
$doFilter$1.apply(ServletFilterProvider.scala:36)
net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$
$anonfun$apply$7$$anonfun$apply$8.apply(Vars.scala:212)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$
$anonfun$apply$7.apply(Vars.scala:211)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply
$6.apply(Vars.scala:210)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.RequestVarHandler$$anonfun$apply$5.apply(Vars.scala:
209)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.RequestVarHandler$.apply(Vars.scala:208)
net.liftweb.http.provider.servlet.ServletFilterProvider$class.doFilter
(ServletFilterProvider.scala:35)
net.liftweb.http.LiftFilter.doFilter(LiftServlet.scala:481)
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1148)
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
387)
org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181)
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
org.mortbay.jetty.handler.ContextHandlerCollection.handle
(ContextHandlerCollection.java:230)
org.mortbay.jetty.handler.HandlerCollection.handle
(HandlerCollection.java:114)
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
org.mortbay.jetty.Server.handle(Server.java:326)
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
534)
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:864)
org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
org.mortbay.io.nio.SelectChannelEndPoint.run
(SelectChannelEndPoint.java:409)
org.mortbay.thread.QueuedThreadPool$PoolThread.run
(QueuedThreadPool.java:520)

On Aug 26, 7:27 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> Folks,
>
> I've made some significant revisions to a number of aspects of Lift:
>
>    - I condensed two of the rewrite phases into one (the header/tail rewrite
>    and the URL rewriting) and improved the efficiency of the former.  The net
>    effect is that the lift:when attribute is no longer on comet components.
>    - I changed comet components to be surrounded by <div> instead of <span>
>    tags.  This allows for nesting of form elements and other block-level
>    elements in comet components.  This may cause some minor layout differences
>    for comet components.
>    - In development mode, the rendered page is validated against XHTML
>    Transitional by default and if there are issues, a red box will appear at
>    the bottom of the page outlining the problems
>
> To disable validation: LiftRules.xhtmlValidator = Empty
> To enable Strict validation: LiftRules.xhtmlValidator =
> Full(StrictXHTML1_0Validator)
>
> Please let me know if there are any strange things that happen to page
> rendering.
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
Aug 26, 2009, 10:51:36 PM8/26/09
to lif...@googlegroups.com
I've just pushed a new version live that will behave more gracefully if the xsd cannot be loaded.
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Reply all
Reply to author
Forward
0 new messages