Home > Domino Tips > Developer > LotusScript > Five special characters in DXL
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Five special characters in DXL


Dallas Gimpel
09.08.2004
Rating: -4.40- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

In Bryce Berry's recent tip Creating hotspot buttons on the fly using DXL, there are some in-line comments/documentation that read as follows:

It's necessary to replace any ampersands in the Database Title with its' HTML equivalent as DXL can't convert special characters such as &, <, and >
< less than = <
> greater than = >
& ampersand = &

In fact, it's not that DXL can't convert these special characters, it's just that they ARE special characters. In XML, there are five predefined entity references used in place of specific characters that would otherwise be interpreted as part of the XML itself. These five characters and their entity references are as follows:

  1. Ampersand {&} = &amp;
  2. Less than {<} = &lt;
  3. Greater than {>} = &gt;
  4. Double quotes {"} = &quot;
  5. Apostrophe {'} = '
So, text can be safely converted to well-formed XML. Example (the code below is a private method in a class):
Private Function convertEntityRef
(pstrValu As String) As Boolean 
        On Error Goto errorThrower 
        Const AMPERSAND = "&amp;" 
        Const APOSTROPHE = "&apos;" 
        Const DBL_QUOTES = "&quot;" 
        Const GT = "&gt;" 
        Const LT = "&lt;" 
        
        convertEntityRef = False 
        pstrValu$ = Replace(pstrValu$, 
{&}, AMPERSAND) 
        pstrValu$ = Replace(pstrValu$, 
{'}, APOSTROPHE) 
        pstrValu$ = Replace(pstrValu$, 
{<}, LT) 
        pstrValu$ = Replace(pstrValu$, 
{>}, GT) 
        pstrValu$ = Replace(pstrValu$, 
{"}, DBL_QUOTES) 
        convertEntityRef = True 
        Exit Function 
        
errorThrower: 
        Call Me.buildStackTrace(Erl, 
Getthreadinfo(1)) 
        Error Err, Error$ 
End Function

MEMBER FEEDBACK TO THIS TIP

This is a good tip. But, what I especially liked is the error handling. Dallas uses a technique that is both simple and powerful -- the best kind of technique.

Powerful: By passing the error up the call stack, he is building a Java-like stack trace, capturing in order each subroutine/function/method/property that is involved and the offending a line number in each of those procedures.

Simple: The code is the same in every procedure's error handler. Only the main subroutine needs to report the error text.

—Grant L.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Dallas Gimpel. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
LotusScript
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication
LotusScript filters and attaches files to a Notes form

XML and Web Services for Lotus Notes Domino
Create an RSS feed in Notes/Domino 8 with XML
Verify scheduled agent status with Domino Extensible Language (DXL)
Top 10 Lotus Notes Domino programming and development tips of 2007
A bevy of Notes/Domino development tips
Loading XML from JavaScript
How to apply XSL style sheets to XML views
Top 10 Notes/Domino developer tips of 2006
A smorgasbord of Notes/Domino development tips
Converting XML files into Lotus Notes documents
Finding the properties of a doclinked Lotus Notes document

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts