Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Xmltocursor losing spaces in text field
Message
De
15/12/2011 15:25:57
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
15/12/2011 12:52:43
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01531126
Message ID:
01531148
Vues:
69
This message has been marked as the solution to the initial question of the thread.
>Hi
>I am using XMLTOCURSOR and am having a problem with text entries being mangled. I suspect this is something to do with user-entry input forms allowing the user to use the |enter| key to move down lines in memo-style fields. But I have no control over this - I just have to work with what I am being sent in the XML file.
>
>Please bear with me whilst I try to explain it as simply as I can! (I will use the pipe symbol rather than the greater-than and less-than signs for the tag delimiters)
>
>One of the tags is called |message|. Below is a single example. In order to display it here, I have copied if from the xml file as displayed in a web-brower and then pasted it:
>
>|message|Dear Brian, Thank you so much for generously agreeing to swap shifts. This means a lot to me and you've really done me the biggest favour. I appreciate it :) Simon|/message|
>
>If I paste it to a text file and then re-paste it here, it has the following format:
>
>"|message|Dear Brian, Thank you so much
>
>for generously agreeing to swap
>
>shifts. This means a lot to me and
>
>you've really done me the biggest
>
>favour. I appreciate it :)
>
>
>
>Simon |/message|"
>
>
>When I run XMLTOCURSOR against the XML file, the message field contains:
>
>"Dear Brian, Thank you so muchfor generously agreeing to swapshifts. This means a lot to me andyou've really done me the biggestfavour. I appreciate it :)Simon
>
>
>Which has resulted in 3 extra spaces after the salutation, and the running together of the words which occur at the end and beginning of adjacent lines. Looking at the vesion from the text file the 3 extra spaces can be seen. This may not be apparent on-screen but they ARE there!
>
>The running together of the lines is not so easily explained as there is an intervening line between the text lines - XMLTOCURSOR seems to strip out all blank lines and CRLF characters.
>
>I have looked through the nFlags parameter for XMLTOCURSOR and tried various cominations but none seem to fix it. Can anyone give me any pointers as to what I am overlooking?

You can't just paste text into a text file. Text file is a bunch of bytes and has no clipboard. You are pasting it into an editor, which may behave in many different ways, depending on what it is - Fox editor, notepad, edlin, wordpad, e, what have you. It may be set to do you a favor by breaking your long lines into shorter ones, and by trimming the trailing spaces.

The crucial question here is whether you are only consuming the xml or also producing it. If you are only consuming it (i.e. someone else creates the xml), then your best bet is to have the cursor ready and open before xmltocursor()ing into it, and have the offending field be a memo.

If you're creating the xml as well, you may just mark the field containing free text as binary (i.e. NOCPTRANS) and it should then be base-64 encoded inside a pair of [CDATA[ ... ]] brackets, and you should get your initial content byte to byte as it was, without any intermediate re-formatting.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform