DITA and XMetaL Discussion
tsrsgm October 27, 2009 at 1:09 pm
How to escapse " charecter while saving the fileOctober 27, 2009 at 1:09 pmParticipants 3Replies 4Last Activity 12 years, 8 months ago
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.
SridharDerek Read October 27, 2009 at 6:43 pm
Reply to: How to escapse " charecter while saving the fileOctober 27, 2009 at 6:43 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.tsrsgm October 28, 2009 at 7:49 am
Reply to: How to escapse " charecter while saving the fileOctober 28, 2009 at 7:49 am
Thanks Derek,tsrsgm October 28, 2009 at 11:54 am
Reply to: How to escapse " charecter while saving the fileOctober 28, 2009 at 11:54 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.Derek Read October 29, 2009 at 11:01 pm
Reply to: How to escapse " charecter while saving the fileOctober 29, 2009 at 11:01 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.
- You must be logged in to reply to this topic.