Java XStream - Ignore tag that doesn't exist in XML

前端 未结 6 811
小蘑菇
小蘑菇 2020-12-28 21:26

I currently use a piece of XML like the following


    Frank Smith
    100023412
    1         


        
6条回答
  •  醉梦人生
    2020-12-28 21:48

    I asked for exactly the same problem.

    How can I make a XStreamMarshaller skip unknown binding?

    And I got a comment linking this post.

    I solved the my problem by extending the XStreamMarshaller.

    public class ExtendedXStreamMarshaller extends XStreamMarshaller {
    
        @Override
        protected void configureXStream(final XStream xstream) {
            super.configureXStream(xstream);
            xstream.ignoreUnknownElements(); // will it blend?
        }
    }
    

提交回复
热议问题