• 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

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: 43081
77
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic