From: David S. <dav...@gm...> - 2017-05-17 18:55:04
|
Hi Vincent, As Ronald says, cssparser would have to work in conjunction with other code to apply the style to the DOM. I've not used it myself, but would something like CSSelly (http://jodd.org/doc/csselly/) do the job? Best regards, David On 17 May 2017 at 12:24, Ronald Brill <rb...@rb...> wrote: > Hi Vincent, > > thanks for considering CSSParser as alternative solution. > CSSParser is a smaller/more focused solution; only parsing the css into > some tree sturcture is the current focus of the project. There is no > support to parse (X)Html and also no > help for mixing the two trees into one. > As far as i know there are two main use cases for CSSParser at the moment: > * parsing a css for error detection or optimization and optional writing > back the optimized version (The cleanup/optimization is not part of > CSSParser) > * parsing a css to support html processing > > The second case is what is done by HtmlUnit (i'm also involved with this > project). HtmlUnit uses NekoHtml to parse (X)Html and CSSParser for css. > Then HtmlUnit uses both > informations to simulate real browser behavior. > If you like i can think a bit if your use case is someting that can be > done with HtmlUnit - give me a sign and i will have a look ;-) > > Outside of this i'm a bit curious about your case. Usually the css is > separated from the Html by idea. Why you like to merge this? > > RBRi > > On Tue, 16 May 2017 18:18:56 +0200 Vincent Massol wrote: > > > >Hi guys, > > > >On the XWiki project (http://xwiki.org) we're currently using CSS4J but > it's painful (several bugs, no issue tracker, no mailing list) so we're > considering migrating to another > library and we're looking at CSSParser. > > > >We use CSS4J to do the following: apply some CSS content to XHTML. > > > >For example: > > > >CSS: > >"span { color:red; }" > > > >XHTML: > >... > ><div id="xwikicontent"> > > <p><span style="background: white;">Hello</span></p> > ></div> > > > > > >Result: > >... > ><div id="xwikicontent"> > > <p><span style="background: white; color: red;">Hello</span></p> > ></div> > > > > > >Is that possible to do with CSSParser? > > > >FTR this is our code where we use CSS4J: > >* > https://github.com/xwiki/xwiki-platform/blob/ > 30d27eb8ec23f7c5a28ca505a75f1c73f8fe0073/xwiki-platform- > core/xwiki-platform-oldcore/src/main/java/com/xpn/xw > iki/pdf/impl/PdfExportImpl.java#L460-L460 > >* > https://github.com/xwiki/xwiki-platform/blob/ > 30d27eb8ec23f7c5a28ca505a75f1c73f8fe0073/xwiki-platform- > core/xwiki-platform-oldcore/src/main/java/com/xpn/xw > iki/pdf/impl/PdfExportImpl.java#L506 > > > >Thanks > >-Vincent > >----------------------------------------------------------- > ------------------- > >Check out the vibrant tech community on one of the world's most > >engaging tech sites, Slashdot.org! http://sdm.link/slashdot > >_______________________________________________ > >cssparser-developers mailing list > >css...@li... > >https://lists.sourceforge.net/lists/listinfo/cssparser-developers > > > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > cssparser-developers mailing list > css...@li... > https://lists.sourceforge.net/lists/listinfo/cssparser-developers > -- David |