Export strings - xstream

I'm using the free package Xstream to export my objects to an XML file. Works nicely except one aspect. Since I'm i a non-english country some special characters may occur in strings in the object I export wich causes problem when the XML files are loaded on a different system than it was saved in. The classical UNIX - Windows ASCII table problem.
So how can I make Xstream export in a system-independent format? Or more simply; if I have a String - how can I convert it to a String with escape sequences as in a properties file? And back.
Pls
/Tomas

Ok, now I have tried a bit, but only on a Windows
machine - no export to other systems.
I have a couple of Q's:
* If the XML is correctly formed, specifiyng a
characther encoding, hen IE and FF should be able to
disply it correctly?If your XML is correctly formed, specifies a character encoding and indeed uses that character encoding then both IE and FF should be able to display it (providing you have the correct fonts and those programs know how to use them).
* Is UTF-8 extensive enough to be used together with
special characters like � � � � � UTF-8 can encode every single Unicode character. Everything that has a unicode value can be encoded in UTF-8
Reason for asking is that if my XML file has the
following format:
<?xml version="1.0" encoding="UTF-8" ?>
<object-array>
<string>Tecken � � �</string>
You should check what file encoding is really in use: Use the HexEditor of your choice and check that every character in your file is represented by exactly one byte, except for �, � and �, which should take 2 bytes. If that's true chances are quite good that you're writing valid UTF-8. If every character uses two bytes (with the first byte usually beeing 0x00) then you're using UTF-16 encoding.

Similar Messages

  • Import & Export Strings method

    Hi,
    I have a multilanguage application. I have used export & import
    strings methods. I have one .txt file for each language but when I
    modify something in my vi I must export all again and then modify the
    tags again for each language file... Is there a way that I can modify
    my vi and I don't have to export all again?
    Thanks,
    ToNi.

    As far as i know you need to export strings again only if you have made any changes on front panel.
    exported file is nothing but a xml file so that you can manually edit it instead of exporting everything again (helpfule if you have done very small changes on front panel)
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog

  • [LV8.2] "Export string" (captions) strange behaviour

    Hi,
    I have 2 VIs. One was made with previous versions of LV (called A), and then re-opened and saved with LV8.2, the other was born in LV8.2 (called B). All is ok. I have some "system checkbox" controls in them, I didn't check the "show caption" and "show label".
    Their label and caption would be like "W 0", "W 1", ecc...
    Open A vi.
    Tools -> advanced -> export strings
    Export caption for control without caption? -> NO, I don't want
    Export block diagram strings? -> NO
    Save the file into "strings.txt"
    Now open the "strings.txt" with notepad, search "W 0", and it appear a string like:
    <CONTROL ID=79 type="Boolean" name="W 0">
    <PART ID=82 order=0 type="Caption"><LABEL><STEXT>W 0</STEXT></LABEL></PART>
    this last string would not be expected !!! it's an error, because I told him "No" in the first questin before.
    infact if I repeat the procedure with B vi, it only appears:
    <CONTROL ID=79 type="Boolean" name="W 0">
    and not also the other <STEXT>  !!!
    I don't know why happens this, is there any particular reason? maybe a general setting that I'm losing? The behaviour is not the same in the two vi.
    Thanks

    "export caption for control without caption?"
    If you turned on your caption at some point, then your control has a
    caption, whether or not it is visible.  The question is not "export
    caption for controls with hidden captions?"  If you never view the
    caption for the control, LabVIEW does not create a caption for a
    control.  For example, if you try to get the caption text using a
    Proprty node for a control where you haven't viewed the caption, it
    will generate an error.
    In the attached code, Caption1.vi has a control which the caption has
    not been viewed.  If you Answer no to the above question, you will get
    Caption1-1.txt.  If you answer yes, you will get Caption1-2.txt.  You
    may notice (in LV 8.5 this behavior is there, I do not knwo about 8.2),
    that the control now shows its caption and has hidden its label.  The
    VI also got saved.  I can now not get Caption1-1.txt to generate again.
    In Caption2.vi, I viewed the caption, then hid it again.  Answering no
    to the question above, I got caption2-1.txt.  Answering yes, I got
    Caption2-2.txt.  The two files are the same becuase the control always
    had a caption.
    Attachments:
    captions.zip ‏8 KB

  • Exporting string to csv keeping commas and new lines

    Hi there,
    I am exporting string to csv and have been removeing new lines and commas like so
    thing.toString().replace(/\n/g, '').replace(',','') ;
    how can I do this iwthout losing the line breaks and commas? I can't have them in atm because messes up the csv.

    JSON is for 'transfering' information that can be reassembled into number, string, array, object, etc. format afterwards.
    Excel can import CSV but it might not understand the complexity of the information. Tyically what you would do is serialize complex information with JSON, recieve it on the other side (wherever that might be) and then deserialize it. After you deserialize it using JSONs abilities to turn your information back into what is was (numbers, strings, arrays and object) it is up to you how you restructure the data for the format you choose.
    Your original intent of preserving CSV is best for Excel or OpenOffice Calc. You didn't mention your intent. JSON would package those (CRLF) \n's for you.

  • How to export string in CDATA with the jaxb xml writer?

    How to export string in CDATA with the jaxb xml writer?
    It read CDATA no problem but it is lost on write.

    Found it:
    ### THIS WORKS WITH SUN JAXB REFERENCE IMPLEMENTATION. ###
    (Not tested with any other)
    In the xsd, you must create a type for your string-like element.
    Then associate a data type converter class to this new type, which will produce CDATA tags.
    Then you must set a custom characterEscapeHandler to avoid the default xml escaping in order to preserve the previously produced CDATA tag.
    Good luck.
    -----type converter-----
    import javax.xml.bind.DatatypeConverter;
    public class ExpressionConverter {
         * Convert an expression from an XML file into an internal representation. JAXB will
         * probably have already stripped off the CDATA encapsulation. As a result, this method
         * simply invokes the JAXB type conversion for strings but does not take any other action.
         * @param text an XML-compliant expression
         * @return a pure string expression
         public static String parse(String text) {
              String result = DatatypeConverter.parseString(text);
              return result;
         * Convert an expression from its internal representation to an XML-compliant version.
         * This method will simply surround the string in a CDATA block and return the result.
         * @param text a pure string expression
         * @return the expression encapsulated within a CDATA block
         public static String print(String text) {
              StringBuffer sb = new StringBuffer(text.length() + 20); //should add the length of the CDATA tags + 8 EOLs to be safe
              sb.append("<![CDATA[");
              sb.append(wrapLines(text, 80));
              sb.append("]]>");
              return DatatypeConverter.printString(sb.toString());
         * Provides line-wrapping for long text strings. EOL indicators are inserted at
         * word boundaries once a specified line-length has been exceeded.
         * @param text the string to be wrapped
         * @param lineLength the maximum number of characters that should be included in a single line
         * @return the new string with appropriate EOL insertions
         private static String wrapLines(String text, int lineLength) {
              //wrap logic, watchout for quoted strings!!!!
              return text;
    ------in caller----
    Marshaller writer = ......
    writer.setProperty("com.sun.xml.bind.characterEscapeHandler", new NoCharacterEscapeHandler());
    -----escaper-----
    import java.io.IOException;
    import java.io.Writer;
    import com.sun.xml.bind.marshaller.CharacterEscapeHandler;
    public class NoCharacterEscapeHandler implements CharacterEscapeHandler {
         * Escape characters inside the buffer and send the output to the writer.
         * @param buf buffer of characters to be encoded
         * @param start the index position of the first character that should be encoded
         * @param len the number of characters that should be encoded
         * @param isAttValue true, if the buffer represents an XML tag attribute
         * @param out the output stream
         * @throws IOException if the writing process fails
         public void escape(char[] buf, int start, int len, boolean isAttValue, Writer out) throws IOException {
              for (int i = start; i < start + len; i++) {
                   char ch = buf;
                   if (isAttValue) {
                        // isAttValue is set to true when the marshaller is processing
                        // attribute values. Inside attribute values, there are more
                        // things you need to escape, usually.
                        if (ch == '&') {
                             out.write("&");
                        } else if (ch == '>') {
                             out.write(">");
                        } else if (ch == '<') {
                             out.write("<");
                        } else if (ch == '"') {
                             out.write(""");
                        } else if (ch == '\'') {
                             out.write("&apos;");
                        } else if (ch > 0x7F) {
                             // escape everything above ASCII to &#xXXXX;
                             out.write("&#x");
                             out.write(Integer.toHexString(ch));
                             out.write(";");
                        } else {
                             out.write(ch);
                   } else {
                        out.write(ch);
              return;

  • Labview 8 export strings

    Hello,
    I tried to convert an Labview 7.1 VI into 8.0.
    for localizing, i am exporting strings an reimport them.
    since i upgraded, i get an error when i reimport the strings.
    Even if save the VI,Export and imediately re-import the strings i get an error message.
    Is this a bug in LV 8.0 or is my source-VI corrupt?
    I would be glad about every hint

    Hello,
    in general, this should work with LabVIEW 8 as well. I am attatching a translator application, which was originally built in LabVIEW 6.1. You can try to translate your VI with this application - actually it is a LLB containing the source code - and see if it works with your VI.
    regards
    Ingo Schumacher
    Systems Engineer Sound&VibrationNational Instruments Germany
    Attachments:
    Translator_Application.zip ‏192 KB

  • Parse export strings

    Hi,
    LabVIEW has a feature to export strings from the front panel to file.
    You go to Tools->Advanced->Export Strings...
    Is there any library out there that parses the output of that file?
    It's not XML so XML parsers refuse to do it. I was wondering if anyone is aware of a library availible in LabVIEW to parse this file?

    Hi Maciej,
    I also thought of finding some way to 'fix' the XML, as you say it would be useful to use an external XML parser, but I couldn't find any existing tools. To make a general one will take some effort! Below is a list of some known issues with the current format compared to XML, it may help you in case you want to make such a tool.
    Missing root element
    XML dictates exactly one root element per XML file. However during our VI strings export, we create multiple root elements per file. Solutions:
    Wrap the individual VI entries into an additional root element
    Use one individual XML file per exported VI 
    Missing quotes around attribute values
    Our VI string export violates the rule that attribute values must be quoted e.g. 
    <CONTROL ID=85 type="VI Refnum" name="StationVIPrototype"> correct would be: 
    <CONTROL ID="85" type="VI Refnum" name="StationVIPrototype">
    Elements that are not properly closed
    Some of our elements such as <NO_TITLE>, <CRLF>, <LF>, etc. are not closed, violating the requirement that all tags must be properly closed. This could easily be fixed by adding the missing forward slash at the end of the tag: <NO_TITLE/>
    Special case: FONT elements
    FONT elements are used as switches to toggle font properties. E.g. to turn a substring of a text bold, LabVIEW uses two tags, one to switch the bold property on and another one to revert the change. Example: This text is normal, <FONT style='B'>this text is bold<FONT predef=APPFONT> and this text is normal again.
    We can fix this by emitting the proper closing tag where the reverting extra tag used to be:
    This text is normal, <FONT style='B'>this text is bold</FONT> and this text is normal again.
    Elements with double angle brackets
    Single angle brackets are "escaped" to double angle brackets. E.g. if a VI description text reads x < y it will be converted to x << y. Similarly, our export creates double angle brackets when it encounters <B> or <I> elements.
    Unescaped entities cause XML parsers to fail, e.g. when it reads X & Y rather than X &amp; Y  -- other examples: less than, greater than, quotes (single, double)
    All the best,
    Ian S
    Applications Engineer CLD
    National Instruments UK&Ireland

  • Imoprt/Export Strings in Translation Builder not working

    Hi All,
    I am new to Translation Builder.
    There is a form which is referring many other forms, when I am importing strings of main form in translation builder, its not importing all prompts and only 25 out of 500 prompts. May be it is not importing prompts from other referring form.
    Among above 25 prompts, I have imported translations from English to German (translation builder). But after exporting the translation and compiling the form in D folder, translated prompts are not visible in German language login.
    I am following the below steps:
    1. Created DB connection
    2. Created New project
    3. Right click > import strings
    4. Base language 'AMERICAN', character set 'WE8ISO8859P1', version ='1' form=form from 'US' folder. (this form also refers other forms which are available under resource directory)
    5. Right click on .fmb > add translation > translation language 'German' & Trns. character set 'UTF8'
    6. RHS double click on GERMAN UTF8 > ok (here its not importing only very few prompts)
    7. Provided translations > save
    8. Click on version > export string and exported to d folder.
    9. Logged in with German language.
    Now translations are not coming.
    Note: First time i am using translation builder.
    Please let me know if I am missing any step or any set is required etc..
    Many thanks..
    Soniya.

    Everything was done from scratch with V28.
    1. 10. 2013 v 16:14, Bob Bringhurst <[email protected]>:
    Re: Customized strings in iPad viewer not working?
    created by Bob Bringhurst in Digital Publishing Suite - View the full discussion
    That's odd. It worked for me when I tested it. Perhaps you should try moving the current xml file to a different folder, downloading a new version, copying and pasting, and rebuilding.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5728130#5728130
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5728130#5728130
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5728130#5728130. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Digital Publishing Suite at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How to export strings with "\"

    When I export a string with backslashes in it (eg. path name to a file) then when this file is imported at run time then backslashes '\' cause the import to fail. So for now I have to replace all "xxx\yyy" strings in exported file with "xxx\\yyy" and then import
    of such MODIFIED file goes OK.
    But this is tedious - is there another way to deal with it ?

    This is caused by the fact that the ASCII backslash character is the escape code specifier, and when the file is read by the import/export properties tool it is treated as such. If you have any character sequences in a string such as "\t" or "\n" these get interpreted as tabs and newlines within the string.
    To avoid this behavior when importing you will need to modify the strings in TestStand before exporting them to include the "\\" escape code set to the file. The caveat to this is once these values are read back from the file they will be interpreted as single backslashes. For instance, if you export "c:\\temp", and then import it back you will get "c:\temp". This is simply the nature of the Import/Export Properties tool.
    If you do not like the b
    ehavior of this tool in its shipping form, you can rebuild the "limitloader.dll" module to include the functionality that you want. Whenever you click the Tools>>Import/Export Properties menu selection, the MainSequence of \Components\NI\Tools\ImportExport.seq is being executed. This has a single step in it that calls the "DisplayImportExportDialog" function of the limitloader.dll. The source for the limitloader.dll can be found in the \Components\NI\StepTypes\Database directory.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • How to find out the index in string.

    Hello Experts,
    I have a requirement in which i have to find out the index of the last space before the 50th position in a string.
    is there any way other than spliting the string.
    e.g. if string is - 'aaaa aaaa aaa........ aaa aaa'(length is more than 50)
    i want the last space before 50th char.because i want to split the string before last word withing 50 th character
    please help.
    Thanks,
    Shweta

    Hi Shweta,
    You can build up the logic from this below program.
    data: line(75) value 'abcdefghijk lmnopqrstuvwxyz zyxwvutsrqponml kjihgfedc ba',
           n_line(50),
           off type i,
           val1(50),
           val2(50).
    CALL FUNCTION 'STRING_REVERSE'
      EXPORTING
        STRING          = line(50)
        LANG            = ' '
    IMPORTING
       RSTRING         = n_line
    EXCEPTIONS
       TOO_SMALL       = 1
       OTHERS          = 2.
    IF SY-SUBRC NE 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    SPLIT n_line at space into val1 val2.
    off = strlen( val1 ).
    off = 50 - off.
    write: 'The index of the last space before the 50th position is at ', off.
    Hope this may help you.
    Regards,
    Smart Varghese

  • Non-breaking spaces export to Excel = ASCII 160, not 32

    We found the following issue with exporting strings to Excel.
    Assume the database Data field contains a string with multiple spaces "Hello____World".For the sake of readability I represent the space as '_' (underscore).
    In OBIEE the normal data format setting is "Plain Text". In HTML source code the data will show up as "Hello____World" but browsers ignore the multiple spaces and show "Hello_World".
    When exporting this to Excel the result in Excel is aso "Hello_World" where the ASCII value of the space character is 32.
    Since this is not what i wanted, I change the data format to "Plain text (don't break spaces)".
    In the HTML source this shows as "Hello    World" and the browser shows it correctly as "Hello____World"
    Now I export this to Excel and Excel shows "Hello____World" as was needed.
    However, when using the data in a VLOOKUP function in Excel it could not match "Hello____World" in another worksheet.
    After some investigation it turned out the OBIEE exports the   to Excel as ASCII value 160. That shows up on screen as a space.
    Everything looks OK but under the hood it is not 'what you see is what you get'
    remedy in our case was export from OBIEE as data (CSV).
    Edited by: user7310695 on Mar 18, 2009 2:53 PM
    Edited by: wim_van_den_heuvel on Mar 20, 2009 8:54 AM

    Wim,
    Thanks for sharing the solution!
    regards
    John
    http://obiee101.blogspot.com/

  • Calculating the AVG's from exported stream data

    Written a program which exports string of time, timing data: 0:11 0:91 0:23 1:20
    it then writes the string to a textfile but as theres multiple rows as below
    this is what the data looks like when its written to a text file - how can I define columns? (1, 2, 3 ) when they don't exist
             title  |    1  |  2  |  3   |  4
    timing data: 0:11 0:91 0:23 1:20
    timing data: 0:13 0:91 0:23 1:20
    AVG:            0:12| 0:92| etc... <<<< this is what I want to do
    hopefully this makes some sense

    Hi,
    Thank you for posting in MSDN forum.
    Since this forum is discuss: Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
    Based on your issue, I think that
    it is more related to the develop issue, so please tell me what program you write which exports string time in VS IDE.
    What language you write this program so
    that we will find the correct forum support this issue?
    Thanks
    for your understanding.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • RichEditableText: export().equals() and HTML export

    1. How can I find out that two richEditableText.export() are equal?
    At least the order of the attributes in the TextFlow element is random which means that exported strings cannot be compared directly. Take for example the trunk.mxml from http://bugs.adobe.com/jira/browse/SDK-21836 and compile+run it several times and you see the different order of attributes. Is there a utility method somewhere to compare two exports? (BTW releasing the source of TLF would ease these kind of bug hunting...)
    I know how to use richEditableText.textFlow.generation but this only indicates changes in the current component.
    2. Is supporting html import/export on the roadmap?
    (This question got burried in the information stream... http://forums.adobe.com/message/2042067#2042067)
    Gordon Smith: TLF's TextFilter class supports importers and exporters for HTML_FORMAT, but I haven't tried them and don't know how robust they are.
    I think the HTML export in TLF is not yet stable. The thing is that once
    it is stable there is pretty much no way to insert the import
    functionality into RichEditableText without rewriting most of the
    component. In my opinion, it should be either integrated into
    RichEditableText even at this early stage or RichEditableText should be
    refactored to allow extending it in an easier way.
    Thanks for any hints,
    Marc

    Hi Abhishek,
    Nice conversation I do not expect that TLF covers the full HTML standard. After all, browsers are too good when it comes to HTML rendering...
    with varying degrees of fidelity.
    I remember reading in the TLF forum, that HTML import/export was experimental. That's why I wrote that HTML is not ready for prime time. Also your comment shows that HTML is a poor choice from a Flex perspective. Unfortunately, it's unclear what varying degrees of fidelity really means as I'm not aware of any precise documentation or code.
    Concerning your idea about passing around a (mutable) instance of TextFlow, I'm not a great fan. The power of markup is besides others, that it is a comparable description of content and format. So I definitely prefer an equal function. If this function doesn't make it into the Flex 4 release, I  reluctantly add to each TLF markup a dirty flag which is based on TextFlow.generation.
    As mentioned before, I prefer TLF could export all content and formatting into HTML compliant format. There are many reasons why HTML is a huge benefit over any new, widely undocumented format (this is not specific to TLF or FXG). A few reasons that come to my mind:
    - Server side: Apache Lucene has a battle-proof extractor. With TLF or FXG, I had to write and configure my own.
    - Server side: Extract and modify links in content. This is obviously very easy with HTML as there are age-old libs available.
    - Flash Player: Compare two TLF markups. There might be also no actionscript lib for HTML available. But I'd happily start a project for HTML but not for a new format without underlining code and thorough doc.
    - HTTP communication: what's the mime type of TLF or FXG?
    - Every developer knows HTML, TLF/FXG must be learned. I regard this learning as a high barrier as TLF does not seem to be a big step forward compared to HTML.
    Note that I don't prefer HTML because it is an "open standard". It's because the whole world knows HTML and that brings a much higher engineering efficiency (and that's maybe due to the open standard). If not all information of TLF can be export HTML, it's a pity but just document it.
    Looking forward to your thoughts/comments,
    Marc
    abhishek.g wrote: Hi Marc,
    Thanks for your reply.
    TLF supports many different markup formats (TLF, FXG, Plain text, HTML) with varying degrees of fidelity. It would simply not do to compare HTML because there isn't a 1:1 correspondence between TLF and HTML capabilities. From that perspective, TLF format would be your best bet though I realize there is the problem of inconsistent attribute order.
    Perhaps your scenario is better addressed by having utilities to compare TextFlow instances rather than comparing corresponding markup (this needs additional thought).
    As for HTML import/export, it is obviously be beyond TLF's scope to implement the full HTML standard. The current implementation is loosely based on the HTML capabilities of flash.text.TextField (see htmlText property), which itself is a small subset of the standard, and deviates from it in some ways. When you say HTML support is not ready for prime time, are you referring to this limited scope, or have you encountered specific bugs in the implementation? If the former, I'd like to know what your expectations are. If the latter, please report them.
    Thanks
    Abhishek
    (Adobe Systems Inc.)
    This message was sent to: faindu
    To post a reply to the thread message, either reply to this email or visit the message page:
    http://forums.adobe.com/message/2059470#2059470
    --end--
    mail transfer stalled...

  • How to identify end of the string is ABAP

    Hi friends,
         While I am doing an operation on a string, I want to identify the end of the string. In C we have <b>\0</b>. But in SAP how can we identify that we have reached the end of the string.
    Sathish Reddy.

    use this function and get there 1st character
    CALL FUNCTION 'STRING_REVERSE'
         EXPORTING
              STRING    = ZFNAME
              LANG      = SY-LANGU
         IMPORTING
              RSTRING   = ZFNAME
         EXCEPTIONS
              TOO_SMALL = 1
              OTHERS    = 2.
    IF SY-SUBRC EQ 0.
      WRITE:/ ZFNAME.
    ELSE.
      WRITE:/ 'ERROR REVERSING STRING'.
    ENDIF.

  • Translation Builder:HOW TO EDIT A TRANLATION STRING?

    I am trying to translate from AMERICAN to FRENCH with the Oracle Translation Builder.
    I successfully did all the steps described in the translation process of the Translation Builder:Create source file,Import strings,Add translation,Translate strings,Export strings. But the translation status for all the translation strings still showed the sign indicating Revision Needed. And nothing were translated.
    Could anybody help me on this problem ?

    I cant see where you are closing the recordStore. Your problem is one of the side effect of not closing the record store.
    BTW,
    It preferred to close it in a "finally" section
    Yaron G.

Maybe you are looking for