Pages: 1
Print
Author Topic: How to escapse " charecter while saving the file  (Read 4894 times)
tsrsgm
Member

Posts: 7


« on: October 27, 2009, 07:09:45 AM »

Hi

We are using XMetal 5.0 (VB Studio) in my application, some time we are entering the text in textbox(UI) "(Double Quotes). We need to escape quptes before saving the xml file.

I am new to this technology, pls help me.

Thanks

Sridhar
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: October 27, 2009, 12:43:38 PM »

I'm not sure which textbox you mean. However, I can point out how the product behaves in the 5.1 and 5.5 versions:

1. If you are typing text into a document in PlainText view you will need to manually 'escape' double quotes where necessary according to the XML Recommendation. This means typing out the full entity name " if required for the document to be valid, for example when they appear inside an attribute value that is double quoted. Likewise, you need to manually 'escape' the ampersand, less-than and greater-than characters.

2. If you are typing text into a document in TagsOn or Normal view in an element with PCDATA content or a CDATA section, escaping the double quote and single quote characters (entering them as entities) is not necessary and XMetaL will not do this for you. The ampersand, less-than and greater-than characters will need to be entered as entities however.

3. If you are typing text into the Attribute Inspector with the document open in any view in a recent version of XMetaL the following should occur:
* If you enter double quotes into a CDATA attribute then XMetaL Author should wrap the attribute value in single quotes.
* If you enter single quotes into a CDATA attribute then XMetaL Author should wrap the attribute value in double quotes.
* If you enter both double and single quotes XMetaL Author should wrap the attribute value in double quotes and then use the " entity for any double quotes inside the attribute.

After the attribute value has been set (you do this by exiting the field you are editing in the Attribute Inspector) if any values have been entered as entities (") then they will appear as such (spelt out in full with the opening ampersand and closing semicolon) and subsequent changes to them basically force you to work as though you were working in PlainText view so you need to know what you are doing at this point. For our clients that have authors that will be doing a lot of work like this we usually recommend implementing a method of entering such attribute values using XFT forms and steering their authors away from the Attribute Inspector to avoid confusion. Otherwise, more extensive training in what XML validity means may be required.

By default (when no special quoting is required) XMetaL wraps attribute values in double quotes.

4. If you are typing text into a dialog box and that dialog box ends up entering whatever you typed (or something based on what you typed or chose) into the document then the behavior could really be anything and will depend on which view you are in and the APIs and logic that was used to insert the text.

All of these behaviors could be altered by customizing the product so if you see different behavior it may be due to customization(s) you have installed.
« Last Edit: June 03, 2011, 06:47:52 PM by Derek Read » Logged
tsrsgm
Member

Posts: 7


« Reply #2 on: October 28, 2009, 01:49:16 AM »

Thanks Derek,

Logged
tsrsgm
Member

Posts: 7


« Reply #3 on: October 28, 2009, 05:54:26 AM »

Thanks for the detailed response.

My requirement is like, I do have an "editbox" in my XFt and I should allow the user to enter quotes(") and he should be able to save the document. But as of now, when the user enters quotes and tries to save the document I receive an error.

Hope I am a bit clear now.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #4 on: October 29, 2009, 05:01:03 PM »

Ultimately, where in your XML is your XFT form inserting the quote character?
If you can paste a copy of the invalid XML the XFT form is creating that would help.
Also, what is the error?

Having that info will help figure out how to code your XFT form so it does the right thing.
Logged
Pages: 1
Print
Jump to: