Hello,
this are non good news. It's a problem for the realisation of my use-case
that there's no possibility to ignore "unknown" attributes. To set
attributes as optional is a good idea, but you have to specify them, even
if you are not interested in them. And if somebody adds a tag to the
xml-file, the marshaller doesn't work.
May be you have a large xml-file with a couple of "main"-parts:
<xxx>
<aaa>
...
</aaa>
<bbb>
...
</bbb>
<ccc>
...
</ccc>
</xxx>
and the data you are interested in is only in part aaa (in my case), you
have to specify the other parts too in the mapping file?
Mmmh, maybe jibx might not be the right solution for me? OK, after
marshalling and unmarshalling you would not get excactly the same file if
ignoring tags while marshalling... but that doesn't matter for me...
Thanks again for your help.
You could specify the tags in the structure and specify them as
optional. I dont think jibx has ignorable xml attributes.
Also, since you have a root element 'XYZ' your xml must start with an
<XYZ> tag.
cheers
Varghese C V
Daniel Reichlmeier wrote:
>
> Hello,
>
> imagine i've created an xml file like this:
>
> <IDENT>
> <DATEINAME>filename</DATEINAME>
> <VERSION-TYP>1234</VERSION-TYP>
> <VERSION-INHALT/>
> <DATUM/>
> <BESCHREIBUNG/>
>
>
<CNT-CHECKSUMME>85ad24d2b89c10cfd80003eebd8cd03d6d49dbbb</CNT-CHECKSUMME>
> </IDENT>
>
> my description in the mapping.xml is like this:
>
> <mapping name="XYZ" class="Yxz">
> <structure name="IDENT" field="ident">
> <value name="DATEINAME" field="dateiname"/>
> <value name="VERSION-TYP" field="versionTyp"/>
> </structure>
> ...
> </mapping>
>
> i'm getting an exception while marshalling the xml-file like this:
>
> org.jibx.runtime.JiBXException: Expected "IDENT" end tag, found
> "VERSION-INHALT" start tag (line 8, col 20)
> at
>
org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:793)
>
> at Zdc.JiBX_mapping_unmarshal_1_0(Zdc.java)
> at JiBX_mappingZdc_access.unmarshal()
> at
>
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2538)
>
> at
>
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2681)
>
> at Main.main(Main.java:25)
>
> Normaly, this is an feature of xml that you can parse OVER unknown
> attributes (maybe you are not interestest in these information). Why
> does jibx not ignore unknown attributes?
>
> Thanks for your help.
> ------------------------------------------------------------------------
>
>
-------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users