• 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

PL/SQL to Extract Plain Text from Formatted Text

 
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I use PL/SQL to extract plain text from formatted text?

For example, how would I extract the plain text from this formatted text?

 
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the UTF_FILE package to open a file, then loop and using the same package read a line at a time into a varchar2 variable, and then use the REGEXP_SUBSTR function to extract the data between > and < .
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So considering the input as an XML document, you would be extracting the content of all text nodes. Was that what you meant by "plain text", Fred?

Note also that if you're really extracting text nodes from an XML document you should really perform XML unescaping on the text nodes; consider the document



where the text node represents the string "Fortnum & Mason".
 
Fred Victa
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ahmed Bin S wrote:Use the UTF_FILE package to open a file, then loop and using the same package read a line at a time into a varchar2 variable, and then use the REGEXP_SUBSTR function to extract the data between > and < .



Thank you.
 
Fred Victa
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:So considering the input as an XML document, you would be extracting the content of all text nodes. Was that what you meant by "plain text", Fred?

Note also that if you're really extracting text nodes from an XML document you should really perform XML unescaping on the text nodes; consider the document



where the text node represents the string "Fortnum & Mason".



Yes, the content of all text nodes.

According to the XML in my OP, the plain text would be this: Test Form 2 des

 
reply
    Bookmark Topic Watch Topic
  • New Topic