Add carriage return in XML file

Hi,
I found a topic that correspond to my requirement :
[Add carriage return in XML file|https://wiki.sdn.sap.com/wiki/display/XI/HowtoappendCarriageReturnintheendofeachtagofxml+file]
But i don't know where created this udf, which input parameter pass?
Thank you for your help.

Hi Frantzy,
The link does not give enough explanation. What I am assuming is if you have xml string in one field then if you need to add new line after each tag then you can follow that.
If you want a udf where you want to insert a new line use this udf:
Create a Value UDF with one input argument 'a' and name the udf as addnewline. Then add this code:
Imports: java.*;
String lines;
lines = "";
lines = lines.concat(a + '\n' );
return lines;
Then where ever you want a new line just add this udf in your mapping. If you want a new line for 10 fields then you can put in all the 10 fields.
Example:
Source field --> logic --> udf (addnewline) --> target.
So after logic if you have the value as 123 then in the target you will see 123 followed by a carriage return.
Regards,
---Satish

Similar Messages

  • How to parse a raw string that returns an XML file?

    Guys,
    Good day!
    I was assign to work on this but I did'nt know what to start. Please help me. The Problem is something like this:
    xml-file = pword(raw data string, token interpretation string)
    returns an XML file of:
    token type,
    token (value),
    position in file
    token terminator - condition that broke the type
    the format of the XML file is:
    <tokenizer date=mm/dd/yyyy file="name">
    <Token position=###>
    <type> quoted String </type>
    <tokenValue> "here" </tokenValue>
    <terminator> unquote </terminator>
    <position> #### </position>
    </Token>
    </Tokens>
    I need your suggestions and idea bout this. Thanks in advance.
    Regards,
    I-Talk

    Strings don't "return files", and XML parsing is pretty much the same, regardless of source. So, what is it you're trying to do?
    ~

  • How to add payment advice for XML file filed in vendor account group

    Hi All,
    I have a requirment to add Payment advice for XML file field in vendor account group under payment transcation tap,
    kindly advice where i can add above mention field in vendor account group.
    thanks
    khaja

    done

  • XI doesn't return an xml file

    Hi,
    I've made a scenario using XI 3.0. I use a file adapter with an inbound synchronous interface to send a xml file to XI. XI consumes a function from CRM using a RFC adapter and an outbound synchronous interface. I've setted "Best Effort" as quality of service too.
    The xml file arrives correctly to CRM and CRM returns the BAPI result to XI correctly too. The problem is XI doesn't return the xml file which it should, that's to say, the xml file sent by XI isn't in the specified target directory (using an inbound synchronous interface and a XI adapter).
    Could someone explain me what happens?
    Thanks in advance,
    Samantha.

    Hi Samantha,
    bad news: File Adapter is always asynchronous, cant get any response. And if you use an interface to send data it is an outbound interface.
    To realize your business logic you must use BPM like
    file (outbound asynchronous) -> BP (abstract asynchronous)
    BP (abstract synchronous) <-> CRM (inbound synchronous)
    BP (abstract asynchronous) -> file (inbound asynchronous)
    Regards,
    Udo

  • Converting Frame files to PDF adds carriage return in code snippets

    Our writing group is using FrameMaker 7.2 with Acrobat 9. The documentation we write includes code snippets. Conversion from Frame to PDF adds a carriage return to the end of any line of code. This causes any snippet containing a wrapped line to be incorrect if it is copied and pasted directly from the PDF.  Does anyone knopw if there's a fix for this?
    Thanks,
    George

    Dear Alexander,
    Thanks for the reply.
    In this I am using the FM 'CONVERT_ABAPSPOOLJOB_2_PDF'. I have checked the settings from SPAD that is also same in both servers for particular output device. But the patches are diffrennt in both the servers, the server from which layout is not coming properly having the high level patches in compare to the other server(which is working fine).

  • Need to add alphabet coordinates in xml file for typewriter file

    I have a flash typewriter file which displays text that is
    preloaded inside the flash file. It has an animated pencil that
    "draws" out each character. It gets it's letter coordinates from an
    xml file and I would like to add a few more symbols so it would
    draw them out. How do I get started on figuring this out. The
    coordinates in the xml file must have been generated by some kind
    of software because I can't imagine the author of this file hand
    wrote each one. I tried to contact the author but I think they're
    too busy or not interested.
    thanks

    Hi Frantzy,
    The link does not give enough explanation. What I am assuming is if you have xml string in one field then if you need to add new line after each tag then you can follow that.
    If you want a udf where you want to insert a new line use this udf:
    Create a Value UDF with one input argument 'a' and name the udf as addnewline. Then add this code:
    Imports: java.*;
    String lines;
    lines = "";
    lines = lines.concat(a + '\n' );
    return lines;
    Then where ever you want a new line just add this udf in your mapping. If you want a new line for 10 fields then you can put in all the 10 fields.
    Example:
    Source field --> logic --> udf (addnewline) --> target.
    So after logic if you have the value as 123 then in the target you will see 123 followed by a carriage return.
    Regards,
    ---Satish

  • Write to spreadsheet adds carriage return

    I am using build array function to put together a number of strings and build an array of strings.  The build array is in a while loop.  A new line is added to the array every loop.  I am using write to spread sheet function to save the spreadsheet to a file with xls extension.  For some reason, a carriage return is inserted within the array.  The array has 9 columns and a carriage return is put after the fourth column.  I have not added this carriage return.  Does anyone know why write to spreadsheet might automatically add a carriage return and how to remove it?  
    Thank you!
    Solved!
    Go to Solution.

    Hi,
    I took your posted VI and compiled it to an exe.  I do not see the carriage return problem you are describing?
    If you compile the VI you attached, do you see the problem or is it only in the original main application (that you cannot share)?
    If the compiled exe works on your PC, does it also work on the 'different' computer where you see the issue with your original code?  
    -If it does work, then the issue must be in the source code for your original code.  Sometimes, if you re-size string constants, for example, it can be hard to see carriage return's.
    Another thing it could be perhaps, is if you are calling the "write spreadsheet" in two different places in your main code, then the way it works is it will write your two (different) input arrays to separate lines.  If it is as in your example VI though, there should be no carriage return in the "middle" of the array.
    For debug purposes, you could consider making a VI that takes a 1D string array input, iterates over each element in the array and searches for the carriage return character and gives an error/message on what iteration it found it, then you can back-track from there to see in the code responsible for making the string that went into that index.
    QFang
    CLD LabVIEW 7.1 to 2013

  • Address Book Adds Carriage Return to Street Field on Import

    I've been having some fun and games trying to import a large list of addresses in a tab delimited file into the Address Book. After finally managing to sort out all the issues with importing the file, I have now discovered that the value for the Street in all of the imported addresses has a carriage return (\r) character appended to them. There was not a carriage return present in the tab delimited file.
    I doublechecked the Address Book entries using Applescript to inspect the final character of the Street field and it was indeed a carriage return.
    I presume that this is due to the mapping of fields in the Address Book to the columns in my file. The Address Book allows you to enter 2 values for the Street, yet I am only using the first one with the second one being set to be ignored.
    However, the import still adds the carriage return character despite the second Street field not being required. It's not obvious that this is happening when viewing entries in the Address Book, yet when it comes to printing the imported addresses onto labels, a blank line is left due to the empty second Street field.
    If I edit the card and amend the Street field to, say, add a comma to the end of the Street or, take it away, the problem disappears. I don't want to manually edit all the imported address of which I have 275. Is there a workaround for this, or some Applescript that will automatically edit all the Street entries to remove the carriage return?
    Is anyone else experiencing this? Could this be classified as a bug?
    Before someone suggests I use the thirdparty Address Book Importer, I have tried that too and it also results in the same problem.
    Stuart
    Mac mini   Mac OS X (10.4.6)  

    The blank line appears when looking at the addresses through applications like SOHO Labels and Envelopes or Imprint. The problem is that the carriage return is added by the Address Book as it is being imported, rather than the carriage return being there already, so loading the tab delimited file into a spreadsheet will not show any carriage return characters.
    In the end I cooked up some Applescript to go through the Address Book and strip out any trailing carriage returns from the Street field for all addresses. I'm no Applescript guru, but the following seemed to do the trick:
    tell application "Address Book"
    set thePeople to every person
    repeat with thePerson in thePeople
    set theAddresses to every address of thePerson
    repeat with theAddress in theAddresses
    set streetinfo to street of theAddress
    if streetinfo ends with "\r" then
    set streetinfo2 to (text of characters 1 thru -2 of (streetinfo as string) as string)
    set street of theAddress to streetinfo2
    end if
    end repeat
    end repeat
    save addressbook
    end tell
    The other alternative was to write a script to parse my file in something like Ruby and then use Applescript to add the records rather than use the Address Book import feature. That would probably have given me some flexibility with being able to add multi-line notes, but the above was quicker to hack together.
    Stuart
    Mac mini (PPC)   Mac OS X (10.4.6)  

  • XQuery contains function failing due to carriage return in XML

    I am trying to perform the following xquery:
    declare namespace tei="http://www.tei-c.org/ns/1.0";
    for $line in //tei:l
    where some $value in $line
    satisfies (contains($value, "A cherdd, myn Siat"))
    return $line
    this works fine for almost all cases except when al 'l' element contains a carriage return half way through it, e.g.
    <l n="15">A cherdd, myn Siat, yn
    batent</l>
    if I try to run the xquery above again to find the whole contents of the 'l' element it fails due to the carriage return
    declare namespace tei="http://www.tei-c.org/ns/1.0";
    for $line in //tei:l
    where some $value in $line
    satisfies (contains($value, "A cherdd, myn Siat, yn batent"))
    return $line
    I've been reading all the usual guides/sites and it seems that it might be possible to mitigate the effects of the 'carriage return' by the use of indexes. What I would really like to do however is to remove all the carriage returns. Does anyone know if it is possible to issue a command to dbxml to do this or should I just continue to investigate indexes?
    thanks in advance
    Edited by: user534203 on 27-Jul-2012 02:05

    I have found a solution to my problem.
    Basically, the problem was that my XML editor, Oxygen, has a 'pretty print' formatting command which cause windows line breaks to be introduced when XML lines get too long to make things easier to read.
    I was saving the files with these line breaks included. Instead I should have been saving the files using the Document>Source>Join and Normalize menu option (Ctrl J). This removes all of the offending line breaks and solves the search problem within the db.
    Hope this helps someone out there.
    :)

  • Using Java, How can I Update, Add, Delete nodes in XML Files.

    Hi,
    I want to store the student record (like Name, Age, school name, total mark etc.,) as nodes in the XMLfile. Also I should able to Update, Add, Delete any nodes (student record) in the XML file. How can I achieve this...using Java
    I am able to read the content of the xml file using xml-parser. But my problem is
    updating the xml file.
    pls suggest some solutions or links with " example source code"
    Thanks :-)

    There are 2 kinds of XML parsers : SAX and DOM. DOM seems to suit your need. You can use JAXP APIs to add, delete or change nodes or attributes.
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/TOC.html provides contents that would satisfy most of the needs.
    To save a DOM modified XML file use java IO APIs to write to the same file from which it was read using a Document object ( doc.getNodeValue() ).

  • Add Doctype to the XML File

    Experts,
    My Scenario is JDBC to File
    For the resultant xml file i have to include a <DOCTYPE> after
    <?xml version="1.0" encoding="UTF-8" ?> while passing it to legacy system ?
    I had written an XSLT Code to acheive this, i checked in XML spy and it is working.
    but in moni iam getting an error in message mapping
    my XSLT Code is
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- Add the Doctype declaration -->
    <xsl:output method="xml" indent="no" doctype-system="http://integratex.quality.techdata.de:8080/ix/dtd/ixOrder.dtd"/>
    <!-- Identity Transform - copy the source XML to the output without any changes -->
    <xsl:template match="node() | @*">
                <ns0:MT_ASNDATAOUT xmlns:ns0="http://aaaaa/sd/SD152.25">
                <xsl:copy>
                                                    <xsl:apply-templates select="node() | @*"/>
                </xsl:copy>
                </ns0:MT_ASNDATAOUT>
    </xsl:template>
    </xsl:stylesheet>
    and the error in moni is
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">GENERIC</SAP:Code>
      <SAP:P1>Parsing error after multi mapping.</SAP:P1>
      <SAP:P2>Expected Message<i> instead of Messages</SAP:P2>
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Parsing error after multi mapping.Expected Message<i> instead of Messages</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Iam doing multi mapping between source and target, is m ulti mapping causing the issue?
    and also check my xslt code,it is working in xml spy as desired.
    Please help me on this
    Appreciate your help.
    Thanks
    Srinivas

    Hi,
    Yes you have to chnage the DTD structure to add DOCTYPE Value,one morething when you executing XSLT mapping Multi Mapping scenario it shouls also supports multi mapping feature.Fisrt execute XSLT Mapping program without multi mapping,let me know how its behaving.
    Regards,
    Raj

  • How to add URL links in XML file?

    Hi,
    I'm having problem with adding the URL links to the flash output. I'm using the XML file to call images and then the corrsponding links. Images are called correctly but when I try to add a link I'm not getting the links, but instead getting the HTML anchor tags as texts. I'm using the XML escape characters to escape the HTML tags but the results are not what I need.
    I'm using the following code:
    <thumbnail preview="large.jpg" thumb="thumb.jpg">
                <title><![CDATA[Finance Services]]></title>
                <discription><![CDATA[&lt;a href=&quot;http://www.google.ca">Google</a>]]></discription>
    </thumbnail>
    Output:
    Images are displayed correctly, but instead of getting the links, I'm getting following text message:
    <a href="http://www.google.ca">Google</a>
    I need to find out what I'm doing wrong. Am I using the correct way to add the links or not?
    Thanks for your time.

    I'm using following code for the Description part, where I need to place the HTML tags:
    var _discription:TextField = previewHolder.discriptionText.discriptionText;
    _discription.htmlText = _xml.thumbnails.thumbnail[photoNum].discription.toString()
    I'm using the htmlText, I tried replacing htmlText with tf.htmlText, but it didn't work. I'm importing the text field using import flash.text.TextField; do I need to import something for HTML tags to work?

  • Add xmlns tag to Xml file using DBMS_XMLGEN

    I am using Oracle Release 10.1.0.4.2 version .
    I want to create a xml file according to some data available in the relational database tables. For the same i created object types and then view with the object types since data is scattered in many tables.
    Then i used DBMS_XMLGEN.getxml to generate the xml with query from the object view.
    Is there an option to add xmlns attribute to the generated xml file.
    Please let me know if any additional details are needed.

    If you want to add the namespace declaration in the root element, I don't think it's possible with DBMS_XMLGEN directly.
    You can instruct DBMS_XMLGEN to treat some object fields as XML attributes by prefixing them with "@" (e.g. "@my_attribute") but you cannot control that for enclosing elements.
    A possible solution is to add it afterwards using XSLT, or insertChildXML, but apparently the latter is not available in your version.
    However...
    For the same i created object types and then view with the object types since data is scattered in many tables.Since the data comes from different tables, why not use SQL and SQL/XML functions to build the document?
    It's straightforward, simple, and doesn't need additional objects.
    select xmlelement("Departments",
             xmlattributes('http://xmlns.example.org' as "xmlns")
           , xmlagg(
               xmlelement("Department",
                 xmlattributes(d.deptno as "Id")
               , xmlelement("Name", d.dname)
               , xmlelement("Employees"
                 , xmlagg(
                     xmlelement("Employee",
                       xmlattributes(e.empno as "Id")
                     , xmlforest(
                         e.ename as "Name"
                       , e.job as "Job"
                     ) order by e.empno
               ) order by d.deptno
    from scott.dept d
         join scott.emp e on e.deptno = d.deptno
    group by d.deptno, d.dname
    ;Output :
    <Departments xmlns="http://xmlns.example.org">
      <Department Id="10">
        <Name>ACCOUNTING</Name>
        <Employees>
          <Employee Id="7782">
            <Name>CLARK</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7839">
            <Name>KING</Name>
            <Job>PRESIDENT</Job>
          </Employee>
          <Employee Id="7934">
            <Name>MILLER</Name>
            <Job>CLERK</Job>
          </Employee>
        </Employees>
      </Department>
      <Department Id="20">
        <Name>RESEARCH</Name>
        <Employees>
          <Employee Id="7369">
            <Name>SMITH</Name>
            <Job>CLERK</Job>
          </Employee>
          <Employee Id="7566">
            <Name>JONES</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7902">
            <Name>FORD</Name>
            <Job>ANALYST</Job>
          </Employee>
        </Employees>
      </Department>
      <Department Id="30">
        <Name>SALES</Name>
        <Employees>
          <Employee Id="7499">
            <Name>ALLEN</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7521">
            <Name>WARD</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7654">
            <Name>MARTIN</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7698">
            <Name>BLAKE</Name>
            <Job>MANAGER</Job>
          </Employee>
          <Employee Id="7844">
            <Name>TURNER</Name>
            <Job>SALESMAN</Job>
          </Employee>
          <Employee Id="7900">
            <Name>JAMES</Name>
            <Job>CLERK</Job>
          </Employee>
        </Employees>
      </Department>
    </Departments>

  • Need to add DTD to my XML file

    Hi,
    i have created my XML file and now i have to add DTD to this file. Is there a method to do this?
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();          try {
                 DocumentBuilder builder = factory.newDocumentBuilder();                       document = builder.newDocument();
         catch ( ParserConfigurationException pce ) {
                                pce.printStackTrace();          
    //add DTD here
         Element root = document.createElement( rootName );
         document.appendChild( root );Thanks in advance.
    Nereida

    I'm Having the same problem.
    I generate a XML document using DOM. And the content of this document varies a lot. It is built based on the resultset of a database query. If the query results 3 columns: name, address and fone. The document will have 3 a structure like this:
    <root>
    <row number=1>
    <name>John</name>
    <address>J Street</address>
    <fone>12345678</fone>
    </row>
    <row number=2>
    <name>Peter</name>
    <address>K Street</address>
    <fone>87654321</fone>
    </row>
    </root>
    What i mean is. The tags inside the row tag will allways be different. Depending on the columns from the query.
    This document will be parsed by a SAX Parser (impossible to use DOM becouse the machine where it will be parsed has very few resources). And then I'll need the DTD for parsing it better.
    The problem is. How to create Dynamicaly the DTD for a DOM Document? How to put it in the resulting XML File?
    Thanks!

  • How can I return an xml file to normal print?

    I typed out a list of CD and saved it but it is filed in xml format and I don't know how to return it not normal print so that I can print it out.  As you may realise I am not very computer literate! Please can someone help.Thanks

    coda, textwrangler, textedit should all be able to open and display xml files
    but there is no direct print or word proccessor route from xml it's a broad format it's
    just tags and how those tags are read and write are up to the program which writes and read the file in question
    so you may end up having to fish out the text you want to print from inside X different tags in the file
    xml can be seen as a text version of .dat which is the binary counterpart

Maybe you are looking for