Talk:XML/Output: Difference between revisions

returns an XML document ?
(returns an XML document ?)
 
(7 intermediate revisions by 4 users not shown)
Line 52:
::Why quoted strings? Why not just enter the example input as plain text? In real world applications, the data would came from user, or from file, or from stdin, etc. Normally, the text is just plain text, with no quotes or escape characters. (Of course the test code that calls the actual function could use string constants, but that is language and implementation specific.) On the other hand, using two input lists would be quite strange way to enter data in real world. It would be more logical to enter the name and remark together, as a pair. (But I don't quite understand what this "remark" is supposed to be.) --[[User:PauliKL|PauliKL]] 15:27, 9 June 2009 (UTC)
:Hi Pauli, I've changed the example above to be without outer quotes for the input text descriptions and removed the backslash. I have chosen the simplest input format that I thought languages could cope with. The focus is to be the generation of correctly formatted XML. The remark is just a device to allow the example to include characters that should be quoted, as is the apostrophe in Tam O'Shanter. --[[User:Paddy3118|Paddy3118]] 18:08, 9 June 2009 (UTC)
::I've (re)done the Tcl implementation as a single combined list (as that's the natural way to do it with Tcl's iterators). Don't get hung up over the small stuff. Note that serializers might be smart enough to know that they don't need to quote in "Tam O'Shanter"; what's required is that documents be syntactically valid XML with the same infoset as the sample. (Matching the strings completely is harder and would be better saved for a task that specifies a specific normalization form; this is not that task.) —[[User:Dkf|Donal Fellows]] 13:00, 10 June 2009 (UTC)
 
==Escaping Escapes==
The output of the Python example has characters like > escaped but in a <pre tag it is viewed as the character rather than the escaped version. As all XML escapes start with an ampersand, I replaced the ampersand in the true Python output with the sequence five character sequence '&amp;amp;' and the output on page reflects the textual output of the program. --[[User:Paddy3118|Paddy3118]] 18:40, 9 June 2009 (UTC)
 
'''Please edit sample output so that preview output looks like program output. Unless you manually escape-the-escapes as above, you will end up seeing the character rather than the escape sequence!''' --[[User:Paddy3118|Paddy3118]] 06:10, 12 June 2009 (UTC)
 
== Should we underline that... ==
 
Should we underline that output differs slightly according to the used parser? LibXML used in C, e.g. does not escape the "'" of O'Shanter, nor " (quot); perl package XML::Mini escapes ", but not ' in O'Shanter ... and other parsers, I can see it from the output samples, do escape ' and "... --[[User:ShinTakezou|ShinTakezou]] 15:44, 14 June 2009 (UTC)
:As far as I can [http://www.xml.com/axml/testaxml.htm see], there is some flexibility as to what ''needs'' to be escaped where. --[[User:Paddy3118|Paddy3118]] 16:28, 14 June 2009 (UTC)
 
== Return or print? ==
 
The task description says "returns an XML document" but to my (untrained) eye many languages are printing the document. Should we change the description to allow printing? Or ask the languages to change?
Anonymous user