If you set the flag 'track-source' to true in your binding, you can get the
line number and element from the Java class files using the ITrackSource
interface in jibx. I used it to create the following exception class which I
found really useful:
class ColladaException extends RuntimeException {
public ColladaException(String message, Object source) {
super(createMessage(message, source));
}
public ColladaException(String msg, Object source, Throwable cause) {
super(createMessage(msg, source), cause);
}
private static String createMessage(String message, Object source) {
if (source instanceof ITrackSource) {
ITrackSource trackSource = (ITrackSource) source;
return "Collada problem on line: " +
trackSource.jibx_getLineNumber() + ", column: " +
trackSource.jibx_getColumnNumber() + ": " + message;
}
else {
return "Collada problem for source: " + source.toString() + ": "
+ message;
}
}
}
Setting the flag:
<binding xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="binding.xsd"
track-source="true">
...
</binding>
Cheers,
Petter
On Tue, Sep 23, 2008 at 2:44 PM, Laurent PETIT <[EMAIL PROTECTED]>wrote:
> Hello,
>
> Another thing that is currently done on my project that uses JAXB is that
> at marshalling time, a custom stax listener has been created that adds
> "on-the-fly" information to the generated XML : the start line and column
> number of some elements.
>
> (FYI, it is then used as debugging hits).
>
> Will this be possible with jibx ?
>
> I yet haven't read all the documentation concerning possible customization,
> but if this seems not possible and may be a blocking argument preventing me
> from using jibx, your answer could help me save time ! :-)
>
> Thanks in advance,
>
> Regards,
>
> --
> Laurent
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users