Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8804605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:38:59+00:00 2026-06-14T01:38:59+00:00

I am looking for a java library which can inline an external CSS file

  • 0

I am looking for a java library which can inline an external CSS file with a HTML document based on its ID/class attributes.

I’ve found jStyleParser but I am not sure if this is the right library for me. I seem to fail to understand if it can do the job of inlining the CSS on the elements from the HTML. The documentation and examples is not what I expected.

Is there anyone who can answer that question or does there exist another library for this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:39:00+00:00Added an answer on June 14, 2026 at 1:39 am

    You may try CSSBox. Just take a look at the ComputeStyles demo contained in the package (see the doc/examples/README file in the distribution package for information about running the demo). It computes all the styles and creates a new HTML document (represented by a DOM) with the corresponding inline style definitions.

    The source is in src/org/fit/cssbox/demo/ComputeStyles.java and it’s pretty short. Actually, it uses jStyleParser for doing the main job, CSSBox just provides a nicer interface for this.

            //Open the network connection 
            DocumentSource docSource = new DefaultDocumentSource(args[0]);
    
            //Parse the input document
            DOMSource parser = new DefaultDOMSource(docSource);
            Document doc = parser.parse();
    
            //Create the CSS analyzer
            DOMAnalyzer da = new DOMAnalyzer(doc, docSource.getURL());
            da.attributesToStyles(); //convert the HTML presentation attributes to inline styles
            da.addStyleSheet(null, CSSNorm.stdStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the standard style sheet
            da.addStyleSheet(null, CSSNorm.userStyleSheet(), DOMAnalyzer.Origin.AGENT); //use the additional style sheet
            da.getStyleSheets(); //load the author style sheets
    
            //Compute the styles
            System.err.println("Computing style...");
            da.stylesToDomInherited();
    
            //Save the output
            PrintStream os = new PrintStream(new FileOutputStream(args[1]));
            Output out = new NormalOutput(doc);
            out.dumpTo(os);
            os.close();
    
            docSource.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a Java library which can notify me about changes on the
I am currently looking for an open source java library which I can use
I am looking for a Java library which can convert Non-deterministic Finite Automaton to
I'm looking for a standalone Java library which allows me to parse LDAP style
I'm looking for a Java library to create block diagrams, which might look as
I'm looking for a java library that works on the android that can download
For my project I am looking for a JAVA library that can help me
I am looking for a library with which I can visualize arrangement of components
I am looking for a Java library/framework/technique of storing SQL statements in an external
I'm looking for a library which can perform a morphological analysis on German words,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.