Edwin,

Thanks again for the suggestion and taking the time to give me a helpful
explanation. It's much appreciated.

Regards,

Derek



                                                                           
             "Edwin Dankert"                                               
             <[EMAIL PROTECTED]                                             
             om>                                                        To 
                                       "[EMAIL PROTECTED]"          
             15/11/2007 14:20          <[EMAIL PROTECTED]>          
                                                                        cc 
                                       dom4j-user@lists.sourceforge.net    
                                                                   Subject 
                                       Re: [dom4j-user] Problem with XPath 
                                       evaluation of values containing     
                                       Hyphens using dom4j                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Dom4j uses a ContentHandler in the background to create the elements,
attributes, text nodes etc.

The ContentHandler.characters(...) method is used to create text nodes.

The description of this method states:

"The Parser will call this method to report each chunk of character data.
SAX parsers may return all contiguous character data in a single chunk,
or they may split it into several chunks; however, all of the characters in
any single event must come from the same external entity so that the
Locator provides useful information."

So, when the mergeAdjacentText property is set to false, all the chunks
are treated as separate text-nodes.

Your XPath will only return the first text-node.

The chunks can be different depending on the implementation of the
SAX Parser or the format of the file, or other file IO related differences.

When you set the mergeAdjacentText property to true, all these chunks
are added together into one text-node and your XPath should return the
full value.

Regards,
Edwin
--
http://www.edankert.com/


http://www.aegon.co.uk

AEGON UK plc: 90 Long Acre, London WC2E 9TF, registered in England (No.
3679296). Scottish Equitable plc: Registered office at Edinburgh Park,
Edinburgh EH12 9SE, registered in Scotland (No. 144517), authorised and
regulated by the Financial Services Authority. Guardian Assurance plc,
Guardian Linked Life Assurance Ltd and Guardian Pensions Management Ltd:
Registered office at Ballam Road, Lytham St. Annes, Lancashire FY8 4JZ,
registered in England (No. 38291, 1397655 and 985480), authorised and
regulated by the Financial Services Authority. Members of the AEGON Group.

DISCLAIMER

This message is for the addressee only. If you've received it by mistake,
please send it back to the sender and delete it, and any copies of it,
straightaway. We may monitor emails on our network for security purposes
and to check they meet legal, regulatory and professional standards. If you
get in touch with us by email, we may keep a record of your name and email
address. We don't accept service of court proceedings by email, unless
we've specifically agreed to this beforehand in writing. We take reasonable
precautions to guard against malicious software and viruses and we
recommend you do the same.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to