Home > Domino Tips > Developer > LotusScript > XML encoding a string
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

XML encoding a string


Ronald Pijpers
Rating: -3.12- (out of 5)

View member feedback to this tip.

XML strings must be encoded to conform to standards. Unfortunately, in Domino there are no XML encoding functions like @URLEncode.

The code below is a LotusScript version of this function. It encodes the five specific entities into their XML encoded ones. For all characters outside of the basic ACII, set it to encode these with the character code.

MEMBER FEEDBACK TO THIS TIP

While this tip is potentially useful, it is, in it's current form, unusable.

  1. "&" must be converted to "&"
  2. "<" must be converted to "&lt;"
  3. ">" can be converted to "&gt;" for strict XML compliance, although I have not found this to be necessary.

—Jack S.

******************************************

I think the code below may be more efficient than that presented in this tip. You don't need to call any function or loop through text character by chara...


RELATED CONTENT
LotusScript
Eight easy steps to open and view Flash files in Lotus Notes
LotusScript agent parses ACL to Microsoft Notepad
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
LotusScript agent moves new mail to folder
Top 10 Lotus Notes/Domino development tips of 2009
Eight easy steps to open and view Flash files in Lotus Notes
LotusScript agent parses ACL to Microsoft Notepad
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

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


cter, you just use the Replace function wherever you need to correct strings for XML. By the way, Replace is new with R6.

—Adam H.

******************************************

This code should use the Uni() function instead of the Asc() function, because XML entities are encoded as Unicode values.

—Rich S.

******************************************

Thanks for your comments on my tip.

Jack S.: I think you misread the code, because it already is in there

Adam H.: You're partially right. For large string this might be more efficient, but you will still need to loop the string character by character for the characters outside the basic ascii set

Rich S.: If the inputStr is Unicoded then you do need Uni()'; if you create the string in script you won't need it.

—Ronald Pijpers, tip author

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

This tip was submitted to the SearchDomino.com tip exchange by member Ronald Pijpers. 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.


Submit a Tip




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 - 2010, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts