Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Function to convert character
Topic Summary:
Created On: 26-Jun-2007 20:22
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 26-Jun-2007 20:22
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

Either someone once told me or I have read somewhere that there is a DXL function that will convert a ">" into "& g t" (with no spaces between the "&" , "g" and "t"). Does this sound familiar to anyone?

As I am working on developing a script to export DOORS data into an XML sheet I am coming across cases where there are ">" and as a result, the file is unable to be parse correctly with some XML parsers.

-------------------------
pete.kowalski(at)motorola.com

Edited: 26-Jun-2007 at 20:44 by Pete Kowalski
Report this to a Moderator Report this to a Moderator
 27-Jun-2007 15:48
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

As you say, some characters are "special" in XML. Here is a list of the characters and how they should be escaped.

As you did, I have added an extra space after the & to stop it being converted by explorer.


& -> "& amp;"
< -> "& lt;"
> -> "& gt;"

You may also need to escape quotes and apostrophes.
" -> "& quot;"
' -> "& apos;"

My first XML exporter did this escaping manually by doing string replacement, but was inefficient and prone to error.

This has now changed and I use MSXML instead. This takes care of all the escaping etc and allows you to concentrate on what is in the export rather than string processing.
Works well for XML import too.

-------------------------
Tony Goodman
http://www.smartdxl.com

Edited: 27-Jun-2007 at 15:50 by Tony Goodman
Report this to a Moderator Report this to a Moderator
 4-Sep-2008 16:13
User is offline View Users Profile Print this message


Kiran Chaturvedula

Posts: 14
Joined: 20-Apr-2008

Can I have a look at your XML exporter/importer?
Kindly send the DXL if available with you, to kiran.chaturvedula@ge.com
Report this to a Moderator Report this to a Moderator
 5-Sep-2008 08:58
User is offline View Users Profile Print this message


Tony Goodman

Posts: 97
Joined: 6-May-2008

Sorry, but I cannot give the source code away.

What I will say though is that my exporter uses MSXML, which means that special characters are escaped automatically and it copes with OLEs etc.

Don't try to escape characters manually in your code - it will be slow and inefficient and sooner or later it will break when it comes across a character you hadn't thought of. Believe me, I know because this is how I wrote my first attempt!

-------------------------
Tony Goodman
Smart DXL limited
www.smartdxl.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.