Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unknown Elements in JAXB 1.6

Status
Not open for further replies.

tommyc7

Programmer
Feb 3, 2007
33
US
Hello. I am an experience Java developer but have never used JAXB before. My client (who is a bit behind the times) is using JAXB 1.6 and Java 1.4. For various reasons, I cannot upgrade at the moment.

The problem I am having is that one of the groups we interface with has decided to add some new XML tags without telling us. I'm trying to resolve the issue without hardcoding the new tags because we don't need them at all. I want to completely ignore them.

Does anyone know of a customization or XSD change that I can use to globally ignore any new tags that we don't specify in the XSD.

In other words, the XML should be validated based on the elements in the XSD and any other tags should be ignored without an exception.

Thanks,
Tom
 
TonHu, I think you might have posted this in the wrong thread. My question is about JAXB and the URL you posted leads to a page having nothing to do with Java at all.
 
@tommyc7 Oh yes it is just fine for you, it describes how you should define an "optional" element in your xsd, so jaxb doesn't choke if it doesn't get that element.

The Epic Fail here is that the interface was changed after publication. It happens 'all the time', but that doesn't mean it's OK!

The Java code on stackoverflow, to ignore any exception on unknown elements, is more like a brute force way of getting things done. It might be enough, but you can still talk the other party into sharing the required interface definitions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top