XML Attribute
-
Hello,
I was wondering if it is possible to store a XML string inside an entity's attribute dictionary.
I have tried to do that using Attribs sample but it did not let me add the string (I guess JSON or JScript are failing to validate the string once it has "invalid" symbols). Another possible problem is the string length. I was unable to find the attribute string length limit.Can I do that?
Do I need to store/retrieve this XML string as a binary package? If so, do I need to use pack()?Regards,
Fernando. -
@fpmalard said:
Hello,
I was wondering if it is possible to store a XML string inside an entity's attribute dictionary.
Sure.
@unknownuser said:
I have tried to do that using Attribs sample but it did not let me add the string (I guess JSON or JScript are failing to validate the string once it has "invalid" symbols). Another possible problem is the string length. I was unable to find the attribute string length limit.
What error did you get? As far as I am aware, there is no arbitrary limit to the key length or the value length.
@unknownuser said:
Can I do that?
Do I need to store/retrieve this XML string as a binary package? If so, do I need to use pack()?Regards,
Fernando.I don't think you will need to do that. What specific errors are you getting?
Todd -
Hi Todd, thank you for your reply.
I'm doing the following steps:
- Insert a simple entity like a circle;
- Right click, Attributes -> Show;
- Add a "Sample" category;
- Add a new Attribute, name as "XML" and value as a XML string;
- Click OK (the XML string appears at the second column of Attribute dialog;
- Click Accept;
- Right click again, Attributes -> Show;
- Error: "Internet Explorer Script Error: Unterminated string constant...Do you want to continue running script on this page?". No matter Yes or No, the dialog stay blank.
I suspect that the attribute data is still there but as Attributes sample uses a Web dialog to display the information the XML string format is causing the error due its special symbols like <,>,",/, etc.
Fernando.
-
Ah, most likely an issue with the attribute script you are using. Where did you get it?
-
Todd, I'm using this one:
-
Do you have a small failing test case?
-
Sure,
Try this XML string:
<?xml version="1.0" encoding="utf-8"?> <soap;Envelope xmlns;xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns;xsd="http://www.w3.org/2001/XMLSchema" xmlns;soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap;Body> <CreateTaskInstance xmlns="http://webservices.ofcdesk.com/"> <sServiceKey>string</sServiceKey> <sSessionKey>string</sSessionKey> </CreateTaskInstance> </soap;Body> </soap;Envelope>
-
Hi,
Why not use Marshall to store/restore very long strings ?
This works well to store all kinds of data, even organized as struct objects, in attributes.
Look here:http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_m_marshal.html
My 2 cts,
Advertisement