Hi Archie,
This has always been the behavior for JiBX. I go through some special
handling in the schema data mode code (org.jibx.schema.elements package,
and the SchemaBase class in particular for the actual verification) to
catch unknown attributes, and if you are willing to take the same
approach in your code you can use that as a model - it basically
involves keeping a list of the known attributes for each element, then
verifying that only those attributes are present in a preset method.
Every other data binding tool I know of also ignores unknown attributes.
Generally you can only detect these by turning on schema validation. But
I agree it'd be nice to catch these automatically (and without the cost
of validation). It's possible that for JiBX 2.0 code generation from
schema I could take the same sort of approach as I use in the hand
generated schema data model to handle it automatically.
- Dennis
Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
Axis2/CXF/Metro SOA and Web Services Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
On 08/25/2011 04:34 AM, Archie Cobbs wrote:
I just noticed that JiBX is allowing arbitrary attributes in the input
that I'm using. This is surprising because I've been using JiBX for
years and never noticed this...
For example, with this binding:
<binding name="binding">
<mapping name="test" class="Test">
<value name="name" field="name"/>
<collection name="strings" field="strings"
create-type="java.util.ArrayList">
<value name="string" type="java.lang.String"/>
</collection>
</mapping>
</binding>
JiBX is allowing this input:
<test>
<name *blah="blah"*>fred</name>
<strings>
<string>string1</string>
<string *foobar="asdf"*>string2</string>
<string>string3</string>
</strings>
</test>
I must be missing something... how do I prevent JiBX from allowing
arbitrary attributes like *blah* and *foobar* above?
This happens with JiBX 1.2.2 and 1.2.3.
Thanks,
-Archie
--
Archie L. Cobbs
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users