[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML parsing the only way?


xml decimal character entity
> > 
> > The quickest code for doing this is to write a loop through 
> > the string,
>
> I see from this and your post on xsl-list that you're a man who likes
> low-level coding.
>

No, Michael, it is not so. I am just trying to match the level of coding
to the level of the problem. And, regarding the xsl-list post, I am not 
asking for lower-level coding; in fact, I think that coding with
perl|python|ruby would be higher-level and more natural than with
XSLT 2.0.

> What's wrong with:
>
> (char)Integer.parseInt(Pattern.compile("&#([0-9]+);").matcher(bunch).gro
> up(1));
>

don't get me wrong, I am not trying to compete. But:

1) it only works with Java 1.4+. I simply don't have it installed on
any of my computers because they are slow and it takes twice as much
time to launch as 1.3.

2) it only returns the first character. The OP asked to convert a bunch
to a string. 

3) it does not handle literal character in the input. The code below does.

If you add all these things to the single line above, you'll get as much
code, only slower and running on fewer platforms.

> Also untested.
>
> OK, add a couple more lines to do hex as well (but the OP didn't ask for
> that).

The code that just retrieves the first decimal character entity from a string
without regexps is as short as the line above. I've just tried to provide
a solution that would work.

Besides, I was just reacting the idea to use DOMDoc for that purpose.

David Tolpin
http://davidashen.net/

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.