how to extract only the ID Selector names and Class Selector names from a CSS file using java Program?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
how to extract only the ID Selector names and Class Selector names from a CSS file using java Program?
Post sample lines from the file and highlight the section of the lines that you want to extract.
If you don't understand my answer, don't ignore it, ask a question.
.bodmas {
font-family: arial;
}
#himas {
background-color:#CCC;
border: 1px solid;
color:#39F;
text-align: center;
}
.tab {
background-color: #F60;
border: 1px solid #39F;
width: 100%;
}
#dth {
border: 0px;
text-align: center;
}
#p {
color:#09F;
text-indent: 20px;
}
#one.two
{
color: red;
}
.three.four
{
color:black;
}
Now i want to Extract the class selectors [.bodmas ,, .tab] and ID selectors [#himas, #dth] and want to list out using iterator in java....
Need Output like..,
List of Class Selectors :
1. bodmas
2. tab
etc..,
List of ID Selectors :
1. himas
2. dth
etc..,
Since CSS is a formal language, in all likelihood Java parsers for this type of task already exist. I would Google for them and then use them, rather than try to re-invent that which has already been well invented.