• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XPATH/XQuery Regular Expression for replacing String pattern

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have following xml to read:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE PROCESS_PO_007 SYSTEM "003_process_po_007.dtd">
<!-- Oracle eXtensible Markup Language Gateway Server -->
<PROCESS_PO_007>
<CNTROLAREA>..
I want to replace any comments in input xml by single space. I want to replace any tag starting with and the string in-between with a space e.g

<!DOCTYPE PROCESS_PO_007 SYSTEM "003_process_po_007.dtd"> should be replaced by ' ' similarly <!-- Oracle eXtensible Markup Language Gateway Server --> should be replace by ' '

I am using following replace function but not successful:

replace(tab.user_data.payload, '<!.*?>', ' ')
but this is not working.

Can anyone suggest what am I doing wrong here
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do this instead?

ps: When I type in, I am forced to use double escape to tamper the rendering engine. The intention is to use the type up as so displayed.
 
Ali Haidery
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am exactly doing the same as you have mentioned. The text formatter just showed it that way. But still it is not working.



 
g tsuji
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In that case, you've to show what is actually tab.user_data.payload: I mean its syntactic meaning as appear in xquery you're using. Normally, it is slashes rather than dots and plenty of $ for variables - but cannot say must always be... Furthermore, its content I suppose is coming from a cdata section or in any case an embedded document. If not what is its content as well?
 
Ali Haidery
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, thanks for your reply.

As in my initial post for this question I have given a portion of this, this data is an xml payload for Oracle Apps Adapter which is sent in a queue. And I have to use this replace function in its de-queue condition. Below is a portion of this input:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE PROCESS_PO_007 SYSTEM "003_process_po_007.dtd">
<!-- Oracle eXtensible Markup Language Gateway Server -->
<PROCESS_PO_007>
<CNTROLAREA>..
 
g tsuji
Ranch Hand
Posts: 734
7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That put the question into a very different context than xquery. The aq supports many modes (or type? raw, varchar2, xmltype...), take note of that specificity you're working on too seems necessary.

In any case, in your dequeue procedure/function try use regexp_replace instead of replace. The pattern is good or modulo just finitely many different forms, in fact two as you surely noticed (one escape xml reserved characters, one not) and a try on both should get you going?
 
Ali Haidery
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes this works as the de-queue condition of oracle apps adapter (oracle soa 11g) <property name="DequeueCondition" value="extract(xmltype(regexp_replace(tab.user_data.payload, '<!.*?>', ' ')),'//PROCESS_PO_007/DATA
 
reply
    Bookmark Topic Watch Topic
  • New Topic