This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

parser breaks regular expression ..................URGENT

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all ,

I have following regular expression
<spec>"(?i)import(?-i).*[.](?i)txt(?-i)"</spec>
when I parse it I want to get it as single line text but it is breaking near right brace like this

START ELEMENT : spec
TEXT:"(?i)import(?-i).*\[.\
TEXT:]
TEXT:(?i)txt(?-i)"

END ELEMENT:spec


I want output as asigle line .




------------------------------------------------
Edit Commet: Disabled smilis in this post.

- m
[ January 13, 2006: Message edited by: Madhav Lakkapragada ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you parsing with a DOM or a SAX parser?
That output appears to say it is parsing as an Element that has three TEXT_NODE type child nodes - is that correct?
If this is from a DOM, try the normalize() method on the spec element to merge TEXT_NODE children.
How is the source XML document created?
Bill
Read this FAQ entry about the use of URGENT - thank you.
[ January 13, 2006: Message edited by: William Brogden ]
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the org.xml.sax.ContentHandler.characters javadocs:

SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks;


In other words, you need to collect those characters, and assemble them into a single string at the end.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic