?
Solved

Problem with character references in HTML Language (Urgent)

Posted on 2003-03-05
8
Medium Priority
?
174 Views
Last Modified: 2010-03-31
Hi everyone,
I need some help to convert character references in an HTML document to the character that the character reference is refering to.
For example, &lt; or &#60; represents the less than sign, &#229; or &aring; represents the letter "a" with a small circle above it. I need some suggestion so that i can convert to these characters in the HTML document. The means that if the character reference &lt; or &#60; appears in the source file, i need to replace all of them with the '<' sign and if the character reference &#229; or &aring; appears , i need to replace all of them with 'å'. There are a whole lengthy list of these character references. At the moment, i can only think of a method of hardcoding the symbols into the java program. Is there a more effective and faster method to replace them?
0
Comment
Question by:flea999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 8077688
> Is there a more effective and faster method to replace them?

not that I know of.
0
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 200 total points
ID: 8078266
One way to not hard code the values in your program would be to create a file with the character mappings. You would read the file in, place all the mappings in a Hashtable as key-value pairs (with the HTML character encoding as the key). Then you would go through the HTML file and replce the encoded characters as you go.

Btw, why would you want to replace &aring; with 'e'? why not with the unicode character \u00e5?
0
 

Expert Comment

by:CleanupPing
ID: 9058893
flea999:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 35

Expert Comment

by:girionis
ID: 9686836
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 9688338
girionis, I think the points should be awarded to me. At least I tried to help the guy, objects provided a simple comment.

Thanks,

\t
0
 
LVL 35

Expert Comment

by:girionis
ID: 9688610
 Hello orangehead911, I recommended objects comment for the simple reason that the asker asked: "Is there a more *effective* and *faster* method to replace them?" (pay attention to the "effective" and "faster" words) which, I also think, there is not.

  The solution you suggested, although a valid one, I believe it is not more effective or faster than the one suggested by the asker.

  Anyway, I do not want to be unfair here. You did very well for leaving a comment. I am sure a moderator will consider a split.
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 9688726
Fair enough! :-)

Thanks,

\t
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question