<ContentFragment><![CDATA[<a target=_blank href=$click_tracking_url$&landing_url=https://www.foo.com><img src='urltoimage.jpg' border='0' alt='' /></a>]]></ContentFragment>
I have this xml segment of a file which i have access to ContentFragment via JAXB. and ContentFragment is a string.
I want to find out how can i capture if the a href is targeted for new window as well as if a click tracking url is there or not.
As far as what i have done, I can do a string.contains("_blank"); or string.contains("click_tracking_url"); then i can parse.
is there a better way to do it such as parsing a href into parts?
There are great Java libraries for parsing XML…
… and there are great Java libraries for parsing HTML …
… but for simply parsing out an “href” inside an
<a>tag inside[CDATA]element:String.contains()andString.indexOf()should be more than sufficient.IMHO…