Hi,

Thank you, I will certainly use the newline option instead of what I described, 
I n the future.

Related to that, am I getting syntax wrong here:

csv:serialize(<csv><record><a>A</a></record></csv>, map {'newline': 
'&#x0D;&#x0A;'})

I get back unknown option ‘newline’. The same for item-separator and method.

Also, about the csv option in RESTXQ, I have a need to accept a variety of CSV 
formats, some day in the future. For examples, CSV might have left and right 
quote characters, instead of double quote characters, or one uses commas 
another uses semi-colons, etc. Do you have a suggestion about how to handle 
that and still use the csv input option?

Kendall

On 11/29/17, 11:59 PM, "Christian Grün" <christian.gr...@gmail.com> wrote:

    Hi Kendall,
    
    > That results in CRLF for me when served from RESTXQ.
    
    With RESTXQ, you could try the following:
    
      declare
        %output:method('csv')
        %output:newline('\r\n')
      function local:csv() {
        <csv/>
      };
    
    > “tems can also be serialized as JSON if the Serialization Parameter 
method is set to csv.”
    > 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_CSV-5FModule-23csv-3Aserialize&d=DwIFaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=BhY9kJjja-TTckKgEI05TpeLKfNjDs4cbYB5msGYY8Q&s=ekp_GDd2EaFjFMLGPJHWnPgakobru0nmSy4nixg3zaw&e=
    
    Thanks for the pointer. I hope the text is more readable now.
    
    Best,
    Christian
    
    
    > On 11/29/17, 2:44 AM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of George Sofianos" <basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of gsf.gre...@gmail.com> wrote:
    >
    >     Hi,
    >
    >     What I'm trying to do is serialize a CSV with CRLF newlines in Linux
    >     using BaseX. It's not really important since my CSV parser supports 
both
    >     newlines, but maybe this discussion can help me understand how BaseX
    >     serialization works, or create an improvement for BaseX.
    >
    >     I'm running BaseX GUI (latest snapshot). I have a sequence of strings
    >     that are CSV. I'm using fn:serialize with an item-separator of xml
    >     entity &#xa; I'm then returning this output as a result of the script.
    >     This gives me about 200 lines of CSV. Copy pasting these lines into an
    >     editor, or using the Save button from the GUI, saves these values with
    >     an LF newline character.
    >
    >     The RFC [2] for CSV files recommends a CRLF character for CSV, so it
    >     would be nice if I can serialize this from BaseX directly. I tried 
some
    >     options from the wiki [1] but had no luck. File module also uses a
    >     system specific newline character. [3] Maybe this is something that
    >     could be a part of CSV serialization issue [4] , or maybe it is 
already
    >     possible to achieve this somehow.
    >
    >     Thanks,
    >
    >     George
    >
    >     
[1|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Serialization&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=xnyCt8OzH6uYfja9WTPafSfCb6z4Xfq7wsTK_WlxGGc&e=]
    >     
[2|https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc4180-23section-2D2&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=f90XqUlysE4EosoDkbQL6CTEkpg35kUhKkmlK6juXY0&e=]
    >     
[3|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_File-5FModule-23file-3Awrite-2Dtext-2Dlines&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=5UXzyZR-HJyffZELtzCZaECemWJnPSkb_wmgFjgDxe0&e=]
    >     
[4|https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1518&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=E-7_NaFPPP_PCUioDBWRaq2jouQno-v4D9LMbeF0gRo&e=]
    >
    >
    >
    

Reply via email to