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

  • SEARCH
  • Home
  • 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 3211628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:45:13+00:00 2026-05-17T14:45:13+00:00

First I want to explain what am I doing and then my problem. I

  • 0

First I want to explain what am I doing and then my problem.
I need to scan a css file and obtain all its internal links(images mainly), but I need to get the line number where the links were found.

Right now I am parsing the files using flute library and it works very well also I am using LineNumberReader in order to obtain the line number where a link was found, but this class throws an incorrect line number.

For example: the link ../../image/bg.gif is in the line number 350 but the method getLineNumber in the class LineNumberReader says 490.

So I will appreciate if some of you can drive me by the correct way and give me a possible explanation why the LineNumberReader class does it.

pd: another solution will be very appreciate.

  • sorry the possibles typos, English is not my mother tongue.
  • 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-05-17T14:45:13+00:00Added an answer on May 17, 2026 at 2:45 pm

    Hi @eakbas and @Favonius Thanks for your answer.
    I finally got a solution, maybe it is not the best but at least works for me.

    As I mentioned before I used the flute library to implement the DocumentHandler class of the package org.w3c.sac package in order to analyze the css file.

    So I implemented the ‘property’ method, this method has 3 parameter, the property name, an LexicalUnit object and a boolean indicating that the property has the important statement or not.

    public void property(String property, LexicalUnit lexicalUnit, boolean important)
    

    As I need the line number where a specific property is found, I made a search and I could see that the class that flute uses to implement the LexicalUnit interface holds the line number(it is LexicalUnitImp), so I used reflexion to make a casting from LexicalUnit interface to one LexicalUnitImp object.

    Class<?> clazz = ClassUtils.getClass("org.w3c.flute.parser.LexicalUnitImpl");
    Object lexicalObject = clazz.cast(lexicalUnit);
    Integer line = (Integer)MethodUtils.invokeMethod(lexicalObject, "getLineNumber", null, null);
    

    I did it in that way because the class LexicalUnitImpl is ‘protected’ and I cannot cast it in a traditional way.

    class LexicalUnitImpl implements LexicalUnit
    

    Note: The class ClassUtils and MethodUtils are part of the commons-beanutils apache library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to give a link to a postscript file, but first I want
I have first to explain a little bit my context, then the question: I
ok, i will explain first what i have, and what i need as result.
First I'm going to explain what I'm trying to do and then explain my
I have an appender that I only want the first X characters (for this
It's not just a capture I'm looking to do here. I want to first
I want to show first element that is hidden by jquery. my html code
I want to print the first 10000 prime numbers. Can anyone give me the
I want to skip to the first line that contains include. <> until /include/;
I want to implement a two-pass cache system: The first pass generates a PHP

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.