XML Entity-Referenes

Posted on 2008-11-15
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
    LVL 73

    Expert Comment

    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

    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 73

    Expert Comment

    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


    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 73

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
    This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now