XML Entity-Referenes

Posted on 2008-11-15
Medium Priority
Last Modified: 2013-12-19
A few questions on XML and oracle:

1. What are entiry referenes in XML? Are they only required for special characters?
2.  Are those entities "&#nnnn" same as ASCII representation?
3.  Does valid XML require to print special symbols/diacritics in numeric entity referenes?
4. How can i get the special characters from oracle database to print in those numeric entities so that XML parsers can read them since they can't seem to read the special character.

Question by:sam15
  • 3
  • 2
LVL 74

Expert Comment

ID: 22971809
1- they are abbreviations or numerical codes to represent a specific character.  Yes they are only for special characters.  However, while there are many codes defined, not all xml processors suport the various standards that defined them.  Only a handful are part of the xml standard itself and thus reasonably "guaranteed" to be supported   ( &apos; &quot; &amp; <  >)

2- no, the numbers are not necessarily the same as the ascii codes,  some aren't even ascii characters.  The playing card symbols for instance are not ascii characters

3 - I'm not sure what you mean by valid xml printing.  XML doesn't print anything. XML is just text in a special format.

4 - You can iterate through the characters using the SUBSTR function and translate them yourself into the codes you want.

wikipedia has a good starting reference and description of the codes.


Author Comment

ID: 22972098
thanks. let me describe to you the issue and what I need.

1.  User A goes to a client  screen (either power builder or html) and enters a book title. This title may contain special characters/diacritics/latin. They usually enter it using ALT NNNN. i believe this is the standard way of entering those diactitics on windows (not sure)



2. correct me if i am wrong but i think the oracle 9i database in we9 character set saves those diacritics in ASCII format. I think it finds the  ASCII equivalent (not sure if it same as the one user types in or not) and saves it into DB (one byter per character).

3.  Now, i need to get an XML file printed on the browser so user B can save it and export it to another desktop publishing software. from what i am reading is that XML parsers fail reading those characters and they have to be translated to &#nnnn or XML entity format.


So this is basically what i need to do is somehowe get oracle to print the valid XML code so that the XML can be valid and understood by other parsers.

thanks for you help
LVL 74

Expert Comment

ID: 22972176
which characters are you referring to?  Anything in the 0-127 range should be fine because that's standard ASCII.

From 128-255 is extended ascii.  The "ALT-xxx" method is a windows/dos convention.  You will have to translate them yourself with a function that converts the extended characters to whatever characterset you want.

Author Comment

ID: 22972224

I a m little confuse. First from a client and DB prespective how do you enter diacritics in your UI and how does the database (we8 character set) really save them?
Can you simulate this in small sql*plus example or not.
LVL 74

Accepted Solution

sdstuber earned 2000 total points
ID: 23000020
using character sets is sort of like numeric precision.

If you try to stick  3.14159265 into an integer you can do it, but if you read the integer back out, you'll get 3.

Same with character sets. If you are reading characters in one character set, to ensure you maintain the integrity of your characters you should use the convert function and explicitly state from which set and to which set and test all of the characters you will be using.

If the convert shows a character losing integrity then you will have to change either the client side or db side character set, or possibly both.

Open in new window


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

839 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