-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid output on incorrect call #4
Comments
SEXML is designed to operate in a functional manner. This effectively means that the I don't feel like implementing this at the moment. Not because I'm against it, but I don't need it and I don't feel like doing it. Good pull requests are always appreciated. Cfr it only escaping the first quoted value in the string: Yes that's wrong. I've just pushed out a fix for it. |
While I agree that SEXML should ignore the semantics of what it generates, generating incorrect XML doesn't seem right. Instead of a regexp check, SEXML could quote values instead of passing them through The package XMLS -- available via Quicklisp -- exports a TOXML function that quotes strings (and other scalar values). TOXML chokes on lists and, as said, this is a feature. Quoting strings will be slower than string concatenation, so it could be made optional for users that seek raw speed. But -- again -- users with special needs could rely on a different outputter. Thanks for your attention. |
As it stands, SEXML allows lists to be placed anywhere. When you supply a list, we assume it should be concatenated. In the functional setting this means that we either receive a list or a string, both of which will boil down to a string input. This seems to work well in practice. Coming back to your question though: in the example you supply, you don't supply a list to the As of the last commit to SEXML, all quote ( Keep in mind that everyone seems to want something different from an XML/HTML generator. I'm not sure what you would prefer, but I assume you'd want an outputter which throws a |
Thanks for your detailed explanation. I have realized that quoting attribute values doesn't make sense at all. Therefore, I agree with your fix. In regard to accepting lists... I don't know XML well and I don't know what to say about it. Would you please provide an example of their usefulness? What instead should always be quoted -- following XML rules -- is text between tags. For instance, this:
returns:
while instead should return:
Again, XMLS:TOXML would serve this purpose. I understand that you are developing this package for your own use and I am already grateful that you are sharing it but, please, if you are not interested to a standard implementation, alert users in the README. Your package is featured in the "Lisp Web Tales" book, therefore novices are expected. Regarding what I would want from an outputter, the sketch that you provided elsewhere is more than enough for my needs now. I am an HTML5 novice, and I would rather gain more experience before designing a library for it. Cheers. |
Ah, I understand what you are getting at. That is indeed a possible issue. I chose to do it this way merely because I wanted to be able to insert raw HTML in case SEXML didn't fit the purpose. It's been handy so far, but I do understand that it may be confusing to some. Personally, I find it the element of least surprise. If we would like to solve this, we would need to introduce the concept of an "html-safe" string. An html-safe string is a string which has been escaped already. Any string that comes into SEXML's realm would need to be coerced into an html-safe string before it could be printed. As of now, there is nothing separated to handle the printing of a single string. We could extend SEXML with specific functionality on how to print a string. This functionality could be overridden in a layer which handles how strings should be printed in a separate contrib. We could name the contrib html-safe. Other contribs would likely need to be extended. Should we go ahead with this? Regarding the construction of a new html library: I built SEXML to be flexible enough so that it encompasses the needs of most users if configured correctly. The general idea is that users are able to configure their XML outputting library by enabling layers (with each layer representing a feature). This should mean that if SEXML is extended with enough features, that far less code would need to be written to support each user's preference. |
Hi, I am leaving for a trip, hence I won't be able to contribute to this discussion for a while. I didn't want you to think that I had disappeared. Cheers. |
Hello,
the following incorrect call (notice that the value of :MULTIPLE is missing):
SEXML silently generates this invalid XML (see the first line):
At least, I think that SEXML should generate valid XML anyway (albeit not what the user intended). However, SEXML could raise an error on calls where the values of attributes are not of the expected types: strings, numbers, booleans... I don't know whether it would make sense to accept characters.
Thanks for your attention.
The text was updated successfully, but these errors were encountered: