escaping from xml string

How to escape from <>, in the xml string of & lt; , & gt; is it possible to convert the entire xml string in this format
ex:
< root > < example > < id > 89 < /ID > < / sample > < / root >
This must be converted to

& lt; root & gt;. & lt; sample & gt;. & lt; ID & gt;. 89 & lt; /ID & gt;. & lt; / Sample & gt; & lt; / root & gt;

myString = " 89 ".

myString.split(")<>

Tags: Flex

Similar Questions

  • Update the xml string values.

    Hello

    I'm on 11.2.0.2 and got table with column nclob that stores the long xml string.

    {code}

    "<? XML version = "1.0" encoding = "UTF - 8"? >

    <? Fuego version = "6.5.2" build "101272 =? >

    < Game >

    < configuration name = "TEST database" type = subtype "SQL" = "DDORACLE" >

    < name = "jdbc.pool.idle_timeout property" value = "5" / > "

    < name = "jdbc.pool.entry.max property" value = "10" / > "

    < name = "oracle.dateEqualsTimestamp property" value = "false" / > "

    < name = "jdbc.schema property" value = "user1" / > "

    < name = "jdbc.host property" value = "hostname" / > "

    < property name = "user" value = "user1" / >

    < name = "jdbc.port property" value = "1521" / > "

    < name = "jdbc.pool.min property" value = "0" / > "

    < name = "jdbc.pool.maxopencursors property" value = "50" / > "

    < name = "oracle.sid property" value = "dbsid" / > "

    < property name = "password" value = "user101" / >

    < name = "jdbc.xa property" value = "false" / > "

    < name = "jdbc.pool.max property" value = "10" / > "

    < / configuration >

    < configuration name = 'TEST base2' type = subtype "SQL" = "DDORACLE" >

    < name = "jdbc.pool.idle_timeout property" value = "5" / > "

    < name = "jdbc.pool.entry.max property" value = "10" / > "

    < name = "oracle.dateEqualsTimestamp property" value = "false" / > "

    < name = "jdbc.schema property" value = "user2" / > "

    < name = "jdbc.host property" value = "hostname" / > "

    < property name = "user" value = "user2" / >

    < name = "jdbc.port property" value = "1521" / > "

    < name = "jdbc.pool.min property" value = "0" / > "

    < name = "jdbc.pool.maxopencursors property" value = "50" / > "

    < name = "oracle.sid property" value = "dbsid2" / > "

    < property name = "password" value = "user201" / >

    < name = "jdbc.xa property" value = "false" / > "

    < name = "jdbc.pool.max property" value = "10" / > "

    < / configuration >

    < / set >

    "

    {code}

    My goal is to update the value of the password so that it is equal to the value of jdbc.schema value < property name = "jdbc.schema" value = "user2" / > in this case user2 | " '01'

    < property name = "password" value = "user201" / > <-that's my goal.

    Concerning

    Greg

    Hello

    You can find a few methods here: How To: nodes of XML update with values from the same document. Oracle of Odie's blog

    They are not applicable to your options and version though.

    This is the first applied to your case:

    declare

    v_xmldoc xmltype.

    Start

    Select xmlparse (document to_clob (t.xmldoc))

    in v_xmldoc

    of my_nclob_table t

    where t.id = 1;

    for r in)

    Select idx, schema_name

    of my_nclob_table t

    xmltable)

    "/ game/configuration.

    passage v_xmldoc

    columns idx for ordinalite

    , schema_name varchar2 (30) path 'property[@name="jdbc.schema"]/@value '.

    )

    )

    loop

    Select updatexml)

    v_xmldoc

    , "configuration/game / ['|]» [to_char (r.idx) |'] Property[@name="password"]/@value'

    r.schema_name | '01'

    )

    in v_xmldoc

    Double;

    end loop;

    Update my_nclob_table t

    Set t.xmldoc = to_nclob (xmlserialize (dash, document v_xmldoc))

    where t.id = 1;

    end;

    /

    Here's another, using DOM:

    declare

    CLOB doc;

    p dbms_xmlparser. Analyzer;

    domdoc dbms_xmldom. DOMDocument;

    docnode dbms_xmldom. DOMNode;

    conf_list dbms_xmldom. DOMNodeList;

    conf_node dbms_xmldom. DOMNode;

    password_node dbms_xmldom. DOMNode;

    schema_name varchar2 (30);

    password_value varchar2 (256);

    Start

    Select to_clob (xmldoc)

    in the doc

    of my_nclob_table

    where id = 1;

    p: = dbms_xmlparser.newParser;

    dbms_xmlparser.parseClob (p, doc);

    domdoc: = dbms_xmlparser.getDocument (p);

    dbms_xmlparser.freeParser (p);

    docnode: = dbms_xmldom.makeNode (domdoc);

    conf_list: = dbms_xslprocessor.selectNodes (docnode, ' / game/configuration ');

    for i from 0... dbms_xmldom.GetLength (conf_list) - 1 loop

    conf_node: = dbms_xmldom.item(conf_list, i);

    dbms_xslprocessor.valueOf (conf_node, 'property[@name="jdbc.schema"]/@value', schema_name);

    password_node: = dbms_xslprocessor.selectSingleNode (conf_node, 'property[@name="password"]/@value');

    dbms_xmldom.setNodeValue (password_node, schema_name |) '01');

    end loop;

    dbms_xmldom.writeToClob (domdoc, doc);

    dbms_xmldom.freeDocument (domdoc);

    Update my_nclob_table t

    Set t.xmldoc = to_nclob (doc)

    where t.id = 1;

    end;

    /

    Post edited by: odie_63 - added DOM example

  • How to read an XML string that is not an XML file?

    I have a script I'm trying to setup that communicates via a socket to retrieve the different directions of a custom Java program.  The Java program listening to requests from the Adobe scripting engine (in my case it is a Photoshop script) on a socket and respond immediately with the next set of directions.  These directions are currently in XML format.  The question I have, is that I can not parse XML data because he entered a new XML object from a string rather than be read from a file.  Even without the socket code, you can see the problem as follows:

    var xml = new XML("<test><data>hey!</data></test>");
    alert(xml.test.data);
    alert(xml);
    

    The first alert "must" return "Hey!" (without the quotes, of course), but it doesn't, while the second warning refers to what you would expect it to:

    <test>
        <data>hey!</data>
    </test>
    

    It works very well if read from an XML file, but from a string, as indicated above, it is just an empty box when attempting to access 'xml.test.data '.  Any ideas on how to solve this problem?  Can it be fixed?  Has it been fixed in more recent versions (I am currently using CS4)?

    Thanks in advance for any help!

    Duh... found my mistake... I was trying to access the data by making reference to the created element 'root '.  Given that is the first tag of the element, it is the installer as the root element, which you don't need to reference.  Change alert to alert (xml.data); fixed.

    Now I feel stupid, lol...

  • To remove data XML from XML using REGEXP_REPLACE tags

    Hello

    I try to use the SQL REGEXP_REPLACE function on a piece of XML, to remove the actual XML data from the weather. My ultimate goal is to end up with a list separated by commas to names of XML elements. In the first stage, I want to just pull all of the actual data.

    I tested the following query, and it initially appeared to work:
    SELECT REGEXP_REPLACE('&gt;THIS IS A TEST&lt;', 
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;' ) AS test_result
      FROM dual;
    Unfortunately, when I applied it to a full XML string, it did not. Here is the query to test that I used:
    SELECT REGEXP_REPLACE('&lt;ROW&gt;&lt;TEST_ELEMENT1&gt;123&lt;/TEST_ELEMENT1&gt;&lt;TEST_ELEMENT2&gt;THIS IS A TEST!&lt;/TEST_ELEMENT2&gt;&lt;/ROW&gt;',
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;') AS test_result
      FROM dual;
    I found myself with the following result:

    * & lt; LINE & gt; & lt; / LINE & gt; *

    What I was trying to a:

    * & lt; LINE & gt; & lt; TEST_ELEMENT1 & gt; & lt; / TEST_ELEMENT1 & gt; & lt; TEST_ELEMENT2 & gt; & lt; / TEST_ELEMENT2 & gt; & lt; / LINE & gt; *

    If you are reading this and you are a Posix regular expression guru, could you let me know exactly where I am going wrong? Regular expressions are not my strong point, but I would better go home.

    Hello

    For your final requirement, the 'commas list names of XML elements', what using XQuery with something like:

    SELECT xmlquery(
      'string-join( for $i in $d//*
                    return local-name($i), "," )'
      passing xmltype('123THIS IS A TEST!') as "d"
      returning content
    ).getStringVal()
    FROM dual;
    
  • Update of a column of table from xml data

    Hello

    I have an obligation to update a particular table from xml data column. to do this, I wrote the code below but I am not able to insert. could you please a peek into that.

    create table emp3
    as
    select *From emp
    where 1=1;
    
    alter table emp3
    add (fax_response varchar2(50));
    
    /*create sequence EmailRecords_XMLFILE_SEQ
      minvalue 1
      maxvalue 999999999999999999999999999
      start with 1
      increment by 1
      nocache;*/
    
    /* create global temporary table EmailRecords_XMLFILE
      (
      ID NUMBER not null,
      xmlfile CLOB
      )
      on commit preserve rows;*/
    
    /* create global temporary table UPD_Email_Records_With_Xml
      (
      id NUMBER not null,
    
      response VARCHAR2(500)
    
      )
      on commit preserve rows; */
    
    
    

    the XML data is

    <FAX>
    <EMAILOG>
    <ID>7839</ID>
    <RESPONSE>FAX SENT</RESPONSE>
    </EMAILOG>
    <EMAILOG>
    <ID>7566</ID>
    <RESPONSE>FAX NOT SENT</RESPONSE>
    </EMAILOG>
    </FAX>
    
    
    

    CREATE OR REPLACE PROCEDURE proc_upd_email_records (
       loc_xml          IN       CLOB,
       p_err_code_out   OUT      NUMBER,
       p_err_mesg_out   OUT      VARCHAR2
    )
    IS
       loc_id   NUMBER;
    BEGIN
       loc_id := emailrecords_xmlfile_seq.NEXTVAL; --created sequence
    
    
    
       INSERT INTO emailrecords_xmlfile --created Global Temp table
                   (ID, xmlfile
                   )
            VALUES (loc_id, loc_xml
                   );
    
       COMMIT;
          insert into UPD_Email_Records_With_Xml --created Global Temp table
            (ID, RESPONSE)
            select x1.id,
    
                      x1.RESPONSE
              from EmailRecords_XMLFILE,
                   xmltable('/FAX/EMAILOGID' passing
                            xmltype.createxml(EmailRecords_XMLFILE.xmlfile)
                            columns header_no for ordinality,
                            id number path 'ID',
                            RESPONSE VARCHAR2(250) path 'RESPONSE'
    
                               ) x1
             where EmailRecords_XMLFILE.id = loc_id;
       COMMIT;
    
       UPDATE emp3 er
          SET er.fax_response = (SELECT response
                               FROM upd_email_records_with_xml pr
                              WHERE pr.ID = er.empno)
        WHERE er.empno IN (SELECT ID
                             FROM upd_email_records_with_xml);
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          raise_application_error
             (-20000,
              'Sorry ! The Xml File which is passed is empty. Please try with Valid Xml File. Thank you!!! '
             );
       WHEN OTHERS
       THEN
          p_err_code_out := 4;
          p_err_mesg_out := 'error in insertion=> ' || SQLERRM;
    END proc_upd_email_records;
    {code}{code}
    
    
    

    Someone suggest me a slightly easier way to insert data...

    Thank you...

    You're complicating things

    A simple MERGE statement will do.

    create or replace procedure (proc_upd_email_records)

    loc_xml in clob

    )

    is

    Start

    merge into e emp3

    a_l'_aide_de)

    Select id

    response

    from xmltable)

    "/ FAX/EMAILOG.

    by the way xmlparse (document loc_xml)

    the columns id number way "ID".

    , path of varchar2 (250) response 'RESPONSE '.

    )

    ) v

    on (e.empno = v.id)

    When matched then update

    Set e.fax_response = v.response

    ;

    end;

    /

    But there is no value added by using these temporary tables if you are not at least an intermediate XMLType column (storage preferably binary XML).

    -What is the input XML code?

    -What is the version of db?

  • XML is not displayed as XML (hierarchical format) but as the xml string

    The condition is:

    To retrieve data of a table and are displayed in a table on a page in the ADF. One of the columns in the DB table is a "Type of XML", which stores the XML.  For each record in the table on page ADF, there is a hyper link, clicking on which the XML code must be displayed in a pop-up window.

    There is no problem to display data in the pop-up window.  But the popup does not display the data as a hierarchy XML (wrapping of lines at the end of each element).  It shows that the XML string...

    If someone could help?

    Concerning

    Christiane

    Add a property row to your inputtext to multi line. otherwise, you will never see the brakes of the line.

    Timo

  • to retrieve data from xml data type

    Hello...
    I have a doubt in the oracle database... Here's how to retrieve data from xml data type?

    Like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
    3 4 toMonth5 5 ctTestPan1 6 costType2 7 toYear2012 8 fromMonth12 9 fromYear2011 10 11
    ') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.
  • Help escaping from user input, whatever they are

    I need help escaping from the user input whatever they may be. Currently, I did the following searches with no luck.

    CONTAINS (columnName, ' % a %', 1) > 0
    CONTAINS (columnName, '% {%}', 1) > 0

    Looking for a Word with a "%' in it as follows"stocks have increased by 13%."

    You must put the % as a printjoin in a lexer and use this lexer in the index settings in order for the % to include in the indexed tokens. Then you can use-to escape to the % as an individual character. You cannot combine sentences using the {and} with wildcard characters who escape. Please see the demo below.

    SCOTT@orcl_11gR2> -- table:
    SCOTT@orcl_11gR2> create table test_tab
      2    (columnName  clob)
      3  /
    
    Table created.
    
    SCOTT@orcl_11gR2> -- lexer with % included in printjoins:
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_preference ('test_lex', 'basic_lexer');
      3    ctx_ddl.set_attribute ('test_lex', 'printjoins', '%');
      4  end;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> -- index using lexer:
    SCOTT@orcl_11gR2> create index test_idx
      2  on test_tab (columnName)
      3  indextype is ctxsys.context
      4  parameters
      5    ('lexer test_lex
      6        transactional')
      7  /
    
    Index created.
    
    SCOTT@orcl_11gR2> -- test data:
    SCOTT@orcl_11gR2> insert all
      2  into test_tab (columnName) values ('The shares have increased by 13%.')
      3  into test_tab (columnName) values ('other data')
      4  select * from dual
      5  /
    
    2 rows created.
    
    SCOTT@orcl_11gR2> commit
      2  /
    
    Commit complete.
    
    SCOTT@orcl_11gR2> -- query:
    SCOTT@orcl_11gR2> select * from test_tab
      2  where  contains (columnName, '%\%%') > 0
      3  /
    
    COLUMNNAME
    --------------------------------------------------------------------------------
    The shares have increased by 13%.
    
    1 row selected.
    
  • Need help to parse the xml string to populate the drop-down list

    Here is my: problem

    I have a hidden text field that contains the text of an xml

    <>facilities
    < building >
    < name > Building A < / name >
    < name > building B < / name >
    < name > building C < / name >
    < name > building D < / name >
    < name > building E < / name >
    < name > building F < / name >
    < name > building G < / name >
    < name > building H < / name >
    < / build >
    < / facilities >

    My goal is to read this with JavaScript xml string to populate a drop-down list with values of element (name). Does anyone know how script that?

    Attached is a sample .xdp

    See you soon,.

    Jesse

    Here is an example of change. I put the code click on the button, so you can see it in operation... You can place this code in the event that makes sense for you. I also added another field to show the DOM (this is for debugging purposes and you can remove this field if you want).

    Paul

  • Extract numbers from a string

    Hello
    i'numbers in the neck of string arrecnote

    Please help me in this...

    Published by: smile on October 7, 2010 05:33

    Published by: smile on October 7, 2010 06:14

    Try this to extract the numbers from a string:

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 'hello-cycle monthly settlement;  865.15 SDR
      2  
    multilat net 218.15 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+.[0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 2007/10 SQL> -- or if you just want the numbers with its decimal SQL> ed Wrote file afiedt.buf 1 with t as (select 'hello-cycle monthly settlement; 865.15 SDR 2
    multilat net 218.15 124 (USD) USAWW-USACC-2007/10' col1 from dual) 3 SELECT * FROM 4 (SELECT REGEXP_SUBSTR(col1,'[0-9]+[.][0-9]+',1,lvl) col1 FROM 5 (select col1,level lvl 6 from t 7 connect by level <= LENGTH(col1) - LENGTH(REPLACE(col1,' ')) + 1)) 8* WHERE col1 IS NOT NULL SQL> / COL1 -------------------------------------------------------------------------------- 865.15 218.15 SQL>

    Published by: AP on October 7, 2010 05:43

  • navigateToURL from XML data

    (Edited for clarity 13:16's)

    OK thanks to Greg, I have this with a redirect built in barchart:

    This is my simple histogram:

    < mx:BarChart = x "561" y = "198" id = "CapitalExpenditures" dataProvider = "{I}" width = "762" showDataTips = "True" fontSize = "12" height = "371" >
    < mx:verticalAxis >
    "< mx:CategoryAxis categoryField="@type "/ >
    < / mx:verticalAxis >
    < mx:series >
    "< displayName = 'Spending' xField="@balance mx:BarSeries ' fill = race "{sc1}" = "{s1}" labelFunction = "formatNumber.
    Click = "navigateToURL (new URLRequest (rptWebsite))" >
    < / mx:BarSeries >
    < / mx:series >
    < / mx:BarChart >

    It works very well, but rather than hard code the URL, I would like to get from XML data that are already loaded into the system and assigned to a XMLList "di". My XML file is structured as follows:

    <>projects
    "< prName work = hours of 'One-project' = '705.50' rptUrl = ' http://www.google.com" / > "
    "< prName work = hours of project 'B' = '370.00' rptUrl = ' http://www.yahoo.com" / > "
    < / project >

    What I want to do, use the URL of the XML file, under the name of rptUrl as the URL path in my re - direct.

    I tried to put everything in navigateToURL (new URLRequest (@rptUrl) "> in but could not compile.")

    My confusion is the place where to insert the value in the URL variable and precisely what syntax to use? I have to use e4X for example?

    I created this function to my redirection:

    public void goUrlTFP(event:MouseEvent):void
    {
    ' rptWebsite =' http://www.google.com "
    navigateToURL (new URLRequest (rptWebsite)) return
    }

    It compiles, but I get nothing in the variable.

    I'm using the wrong syntax? I have to do something other than a mouseEvent of my function? Should I trigger the function somewhere else to the click event? I have to browse the file and fill a XMLList or something?

    I tried rptWebsite=item.@rptUrl and rptWebsite=ceDs.@rptUrl, but those who could not compile

    M.

    M, without trying to sound like I'm raggine on you (yet), I'm curious to know how you go about detective your way through the API to come up with possible solutions. What is your thought process? I wonder if it wouldn't you get more if you provide some tips on how to use the API correctly. Teach you to fish instead of giving the fish (for setting the proverb a little).

    I certainly did not know the answer to your problem just a few minutes ago, but it's literally what it took me to find what I think can be an answer to your problem.

    You have defined your features such as:
    Click on a bar chart and have it redirect to a URL that does not exist in the dataProvider of the histogram.

    How can we get these data to URL? The first thing to check would be click events. We look at the possible events that can be shipped when clicking the chart element (BarSeries) or component BarChart himself. When you look at the 'click' for the two event I wasn't expecting much in the measure where this event carrying additional information that I might be able to use, it's just a simple click event. And if I did event.currentTarget, there is no property that directly gives me the data I'm looking. However, in the API, I see an event type itemClick ChartItemEvent (under events) for BarChart which seems promising.

    Then I look in the API to ChartItemEvent and note that there is a property "hitData" type HitData which seem also promising. Now I look at HitData in the API and see that there is a property "item. It's more likely that the element that is used to render the particular BarSeries I clicked on. So I think that I can easily get the related data on an itemClick event.

    I tried and it was of course the data that I expect. I can remember something painfully obvious and much simpler to obtain these data, but I think this thought process shows that with a little effort, you can get a few runs in the API that you will probably have your solution. I doubt there is anyone on this forum who knows everything there is to know about the API. Use the docs, they are your friend.

    BTW, what is the other language that you are more familiar with what you're talking about from time to time?

    TS

  • XML document in XML string

    Hello
    I'm new to BPEL, so please don't mind ask me fundamental questions.

    I want to know how we can edit a document xml into xml string in BPEL (11G). Please notify.


    Thanks for your help.

    function ora:getContentAsString('Varaible') to convert the XML to a string.

  • Eliminating duplicates from a string

    Hello

    I would delete the duplicates of the coma-separated string using the pl/sql functions.
    How can I achieve this?

    Thank you

    You don't need a plsql

    with t as (select 'SCOTT,ALLEN,KING,SCOTT' as in_cls from dual)
    , t1 as ( select distinct regexp_substr(in_cls, '[^,]+', 1, rownum) names
                      from t
                      connect by rownum <= length(regexp_replace(in_cls, '[^,]'))+1)
    SELECT
        RTrim(xmlagg(xmlelement(a,names||',').extract('//text()')),',') string
    from t1
    /
    
    STRING
    ------------------------------------------------
    ALLEN,SCOTT,KING
    
    1 row selected.
    

    SS

  • How know no.. given occurrences of a sting from a string

    Hi all

    How will I know the No. given occurrences of a sting from a string.

    Your help would be appreciated.

    Thank you
    Srinivas

    calculation of no.. of occurrence of a string
    -------------------------------------------------------
    declare
    str1 varchar2 (100): = 'string. '
    str2 varchar2 (1000): = ' this is the string where the string are placed. This pl/sql is used to find the accurance of a string in another string ";
    Start
    dbms_output.put_line (length (str2) - length (replace (str2, str1, substr (str1, 1, length (str1)-1)));)
    end;
    /

  • Help: Casting String obtained from Xml to a number Type

    Hi all

    I have a big problem, I have analyzed the data of a global vars into flash xml doc and to do a few of them, as the numbers for the things of the position of 'nodes' on the screen. However I can't get the data stored in the var for an int or number value.

    For example, in the code below when you press the set of node, it retraces familiar with the 'node' X value, then the value in the global var obtained from the XML, that contains the x position of where to place the node.

    Then, it creates a new var of Type Number and assigns the value of the string global var.

    He then traces the new value of SNtopLeftX and assigns the value of SNtopLeftX x POS of the clip of the node

    However the node does not move and this is the output I get traces

    Starting node is at x =-734.5
    nod_topLeftX is 16
    TopLeftX = 16
    SN TopLeftX = NaN

    I don't understand why I get NaN when the nod_topLefX string is 16, any IDE?
    ------------------------------------------------------------------------------------------ -------------------------

    I managed to gwet'in, he works with the help, I can force it to an integer using:
    _Global.nod_topLeftX = parseInt(xmlDoc_xml.firstChild.childNodes[3].childNodes[0].childNodes[3].childNodes[0]);

Maybe you are looking for