How to find a substring in XML-lookslike string?

Hi,
I have a question and wondering if anyone can help me with it.
We have Java tool that does a string replacement inside another string (that is actually an XML request). It works fine when searching for a simple substring (that exists within 1 line of the XML string).
But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. And I'm not sure what is wrong or (more importantly) how to make it work.
There is no return or new-line chars seen in the XML request.
To make it more clear - here is what I have and trying to do:
<a>
<a>
<b>
<c>
<d> </d>
<c>
<c>
</c>
</c>
</c>
</b>
</a>
</a>
If I'll seach for either <c> OR </c> OR <d> </d> it all works fine ... BUT if Itry to find
</c>
</b>
which will be copied directly from the XML request and past into field - thus it will look like this (horisontal line instead of vertical) </c> </b> - it does not work

qavlad wrote:
But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. First statement - "more than 1 line"
There is no return or new-line chars seen in the XML request.Second statement.
There is no way that I can understand what you meant in your first statement in terms of your second.
If there are no end of line characters at all then there is only one line. Period.
If there are end of line characters, of any kind, then that would really suggest the source of the problem.

Similar Messages

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • How to find as ascii value for a string or char in unicode system?

    Hello,
    How to find an ascii value for a string or char in unicode system?
    Thanks in Advance

    hi ,
    report demtest.
    data : c.
    field-symbols : <n> type x.
    data : rn type i.
    c = 'A'.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    This will convert 'A' to 65.
    Tom Demuyt
    How to convert ascii value to character.
    If I give input as 65 (ascill value) I want display 'A'.
    Below logic is for convert from character to ascii value , now I want to know how to convert ascii value to character.
    Naveen
    report demtest.
    *going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    *going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    regards,
    venkat.

  • How to find and modify underlying XML Template for a OA Framework page

    Env: R12
    There is a standard OA Framework page in Purchasing that can be reached by
    Purchasing Manager > Buyer Work Center > Orders > Search for a specific PO > Open the PO Page
    Then Open the PO Details page for what you searched
    Now in the PO Details Page, On the right hand top corner is a drop down list for Actions > View PDF
    This generates a PDF output of the PO, PO Details and the terms and conditions.
    I want to modify this pdf. ( Change the template and add/remove a few columns)
    I believe that this is an XML Pub report running in the background but how to find out what report is running and how to modify its template ??
    Thanks
    Gabbar

    Hi Gabbar,
    Click on 'About this Page' and figure out the page, controller, AM and VOs. You can download these xml and class files from JAVA_TOP. Page can be downloaded from mds directory under PRODUCT_TOP.
    Regards

  • How to find XSD file? XML to ABAP using XSLT convertor

    Hi Gurus,
    I am trying to convert an XML file to ABAP internal tables using an XSLT transformation. I used the code posted by Durairaj (XSLT program Y_XML_2_ITAB_SIMPLE as mentioned in the link: [Y_XML_2_ITAB_SIMPLE|Parse data to Internal Table;) and the code worked fine.
    My XML file structure is different, and when I try to modify the code for my purposes I got stuck. While changing the XML file strings in the report, I am unable to replace the tag xsi:noNamespaceSchemaLocation="invoice_btm.xsd" correctly. I am also not sure what this file "invoice_btm.xsd" does and where it is stored. When I remove the tag, I get other errors and cannot proceed ahead.
    Can you please advice as to how I should proceed? Also, where can I see the XSD file? can I add a XSD file for my own XML? Or, is there a way to eliminate the need for an XSD file altogether?
    Thanks in advance.
    Regards,
    Shailesh.

    Hi guys,
    Any help would be most helpful. Thanks again,
    Hi guys,
    Any ideas on this issue? Thanks again for your help.
    Hi Naimesh,
    Thanks for the quick reply. I am getting the error "The element abap was expected for the XML-ABAP transformation". I have replaced the following:
    1) "INVOICES_BTM" with the string "ACCOUNT_INFO"
    2) "INVOICE_BTM" with the string "ROOTNODE"
    My XSLT:
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="ACCOUNT_INFO">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTPUT>
              <xsl:for-each select="ROOTNODE">
                <items>
                  <INV_DATE>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_DATE"/>
                  </INV_DATE>
                  <INV_NO>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/NUMBER"/>
                  </INV_NO>
                  <INV_EXT>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/EXTENSION"/>
                  </INV_EXT>
                  <INV_SEQ>
                    <xsl:value-of select="INVOICE_HEAD/INVOICE_NUMBER/SEQUENCE"/>
                  </INV_SEQ>
                </items>
              </xsl:for-each>
            </OUTPUT>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    My XML program:
    TYPES: BEGIN OF stru,
             inv_date(10),
             inv_no(50),
             inv_ext(10),
             inv_seq(10),
           END OF stru.
    DATA: outtab TYPE STANDARD TABLE OF stru .
    DATA: xslt_error  TYPE REF TO cx_xslt_exception,
          xslt_message  TYPE  string .
    DATA: xml_string TYPE string .
    CLEAR xml_string .
    CONCATENATE
    '<?xml version="1.0" encoding="ISO-8859-1"?>'
    '<ACCOUNT_INFO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ROOTNODE.xsd">'
      '<ROOTNODE>'
        '<INVOICE_HEAD LANGUAGE="DE" DIRECT_DEBIT_QUALIFIER="NO">'
          '<INVOICE_DATE>20040112</INVOICE_DATE>'
          '<INVOICE_NUMBER>'
            '<NUMBER>0306299999</NUMBER>'
            '<EXTENSION>1</EXTENSION>'
            '<SEQUENCE>01</SEQUENCE>'
          '</INVOICE_NUMBER>'
    '</INVOICE_HEAD>'
    '</ROOTNODE>'
    '<ROOTNODE>'
        '<INVOICE_HEAD LANGUAGE="DE" DIRECT_DEBIT_QUALIFIER="NO">'
          '<INVOICE_DATE>20040113</INVOICE_DATE>'
          '<INVOICE_NUMBER>'
            '<NUMBER>0306299888</NUMBER>'
            '<EXTENSION>2</EXTENSION>'
            '<SEQUENCE>02</SEQUENCE>'
          '</INVOICE_NUMBER>'
    '</INVOICE_HEAD>'
    '</ROOTNODE>'
    '</ACCOUNT_INFO>'
    INTO xml_string .
    TRY .
        CALL TRANSFORMATION ('ZH2_XML_TRANS_I1')
          SOURCE XML  xml_string
          RESULT     output = outtab.
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
    ENDTRY.
    break-point.
    Edited by: Shailesh S Kamath on Jan 16, 2012 2:17 PM
    Edited by: Shailesh S Kamath on Jan 30, 2012 2:47 PM

  • How to find out no of lines in  String

    Hi all,
    How to find no of lines in a multi lined String.
    For example.
    String str = "hjkhjkhjhjhkhlk\nfjdhfjhdjfhjdhfj\nfdhfjdhjfhdj\ndfjdkjffjdfjk\nfdffdh";
    Here there are 5 lines because there are "\n".
    I am not able to substring with "\n".
    Any idea please?

    javadocs StringTokenizer
    StringTokenizer(String str, String delim)
    Constructs a string tokenizer for the specified string.
    Method Summary
    int countTokens()

  • How to find by DEFAULT the EXACT text string (and no more) with Acrobat Pro?

    How to find by DEFAULT (always) the EXACT text string (and no more) with Acrobat Pro? Adobe Acrobat Pro 9.2.0 search engine finds USELESS hits on Mactel with Mac OS X 10.5.8.
    For instance, if I search for "sec" (no quotes) trying to find ONLY hits with sec (for second, like in: it took 20 sec), it finds useless hits like: security, etc (any word containing sec, which is NOT what I want).

    Any idea on how to do it by default with Adobe Acrobat Pro 9.3.1 on Mac OS X 10.6.2 (Snow Leopard)? Thanks.

  • Here's how to find the right word in a string

    I needed to find the rightmost word in a string. I didn't find a simple formula in these forums, but I now have one, so I wanted to share it. Hope you find it useful.
    Assuming that the string is in cell A1, the following will return the rightmost word in the string:
    RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    I found the problem. Whatever character was being used in the substitution was parsed out by the forum parser. I replaced it with "œ" (option q on my keyboard).
    =RIGHT(A1,LEN(A1)-FIND("œ",SUBSTITUTE(A1," ","œ",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
    Still needs an error check for a single-word "sentence" and to remove the trailing period but it does seem to work. Pretty slick.
    Message was edited by: Badunit
    I see below that the problem was fixed by the OP.
    Message was edited by: Badunit

  • How to find out if AE_init_append_data.xml has been imported or not?

    HI Gurus,
    Is there a way in CUP to find out if the initial config files have been uploaded or not the AE_init_append_data.xml. There are 2 files which need to be uploaded initially. However the other one uses a clean and insert option. So I think if I do that again, I would be allright. But the init_append.xml uses the append option. So is there a way I can find out if this is already uploaded. A table name which would contain the data from these files perhaps?
    Regards,
    CP

    Hi Prakash,
    I think you can upload the 'AE_init_append.xml' file. Anyways, you will select the append option, so it will just append(if it was uploaded earlier). There will be no problem if you upload the file.
    Thanks & Regards,
    Venky.

  • How to find the total length of the string drawed in a rect?

    Hello Everybody,
    I am drawing a string in on one rect using drawInRect method. This drawInRect method gives us a return value as size of the rect. I need length of the string that is did draw in that rect, but didn't find any api to do this.
    Can anyone tell me , how find the length of the string which we did draw in rect?
    Any help regarding this issue , is highly appreciable.
    Thanks,
    Pandit

    Hi Adreas,
    First of all, very thanks for the response.
    Actually , I am looking for other thing. Using drawInRect method I am drawing contentString in self.rect like below.
    //code
    [contentString drawInRect:self.rect withFont:[UIFont fontWithName:@"Verdana" size:14.0] lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
    //End
    My contentString is much larger string, so I am not able to draw it in rect(length: 320.0 height: 460.0) completely. My rect is showing only a part of a contentString. So I need to get that part of string which did draw in the rect, so that I can process my contentString to get the remaining string to draw it a next rect.
    The above code statement is returning me the CGSIZE , it is giving the size of the rect but not giving any information of the string which get draw in that rect.Do you have any idea how to do this?
    Any information on this is highly appreciable.
    Thanks,
    Pandit

  • [CS3, VB] How to find text and store as a string

    Dear all,
    I'm stymied again with what seems a simple thing. But you hear that a lot.
    I want to find a reference number in a document and then use that to create a filename later on.
    I've got this far, adapting code from another topic:
    myString = "Release No. ^9^9^9^9"
    Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
    Set myInDesign = CreateObject("InDesign.Application.CS3")
    Set myDocument = myInDesign.ActiveDocument
    myInDesign.FindTextPreferences = idNothingEnum.idNothing
    myInDesign.FindTextPreferences.FindWhat = myString
    set myFounded = myDocument.findText()
    call myInDesign.select(myFounded.item(1))
    I know I shouldn't have to select it as such, but anyway, I'm stuck converting the found text into a string. And then I want to just grab the four digits.
    Also, could you provide the code to put that into a if/then statement in case it doesn't find anything?
    Thanks
    Nigel

    Perhaps we need some clarification.
    Can you post one -> Good Data
    one -> Bad Data
    And, the required output - i mean the way you want to display those bad data. And, also post your exact oracle version by this way ->
    select * from v$version;Regards.
    Satyaki De.

  • How to find 2 different characters from a string

    Hi All,
    I would like to remove 'T' and 'Z' from "20110428T10:33:45Z" and convert the string in date/time. I was looking at instr function but that allows to search for one character only.
    Thans for the help.

    With 10g
    SELECT REGEXP_REPLACE ('20110428T10:33:45Z', '[T|Z]') dt
      FROM DUAL
    DT             
    2011042810:33:45
    1 row selected.For the conversion
    SELECT TO_DATE (REGEXP_REPLACE ('20110428T10:33:45Z', '[T|Z]'),
                    'YYYYMMDDHH24:MI:SS'
                   ) dt
      FROM DUAL
    DT       
    2011-04-28 10:33:45
    1 row selected.

  • How to find out White Space

    Hi,
    I want to read the string between whitespaces. How to find out whitespace in the given string using java.
    Thanks,

    sabre150 wrote:
    I know I shouldn't be but I'm always surprised when people re-invent the wheel and implement a 6 line solution when a 1 line solution is available. And even though I shouldn't be, I'm still surprised when they say, "I tried but it didn't work," without any indication of what exactly they tried or how exactly it didn't work. Even after all this time, it still truly baffles me.

  • How find shape containing all pixels in string drawn at angle?

    I've drawn a string on a JPanel at an angle using the code below. I want the mouse to turn into a hand when hovering over it but I don't know how to find the shape that an angled string comprises. (I can do it if it's written horizontally). How would I calculate that?
    double theta = Math.toRadians( angle );
    AffineTransform transform = AffineTransform.getRotateInstance( theta );
    ( ( Graphics2D ) graphics ).setTransform( transform );
    graphics.drawString( text, x, y );

    For the String you can create a Rectangle where the String is contained when it has no rotation. After that you can create Area (see java.awt.geom.Area) from the Rectangle and use transform() method of area to get a rotated one. Then just use contains() method.
    Regards,
    Stas

  • How to find the right XML files

    Hi all
    I need to customize OBIEE according to the custommers needs,Is there any tool to find the xml source files where I can make the changes.
    Currently I'm using 'psoug' to edit the page source code , for example I want to modify those values:
    <tbody>
    <tr>
    <td class="XUISectionHeadingTitle">Columns</td>
    </tr>
    <tr>
    <td class="XUISectionHeadingText">
    Click on column names in the selection pane to add them to the request. Once added, drag-and-drop columns to reorder them. Edit a column's format, formula and filters by clicking the buttons below its name.
    and I don't find the xml file to update it.
    Anyone knows how I can find it?

    *(BIInstallDir)\OracleBI\web\msgdb\l_en\messages*
    Under this path you can find the list of XML files....
    These XMLs are named to indicate what type of info it contain..

Maybe you are looking for