Re: [Simple-support] Availabily of object inlining
Brought to you by:
niallg
|
From: Aaron D. <di...@he...> - 2012-07-30 19:28:46
|
Am 30.07.2012 20:20, schrieb Maxim Solodovnik: > Hello Niall > > sorry for double post > I was able to parse "inline" object by using following "ugly" code: > InputNode root = NodeBuilder.read(new FileInputStream(xml)); > InputNode root1 = NodeBuilder.read(new FileInputStream(xml)); //HACK to > handle Adresses inside user I don't see how that could help since it reads the same file twice (instead of reading more nodes in the same file). > can you advise how can I handle duplicated element in source XML (one > element was printed twice by mistake) Yes. Remember: If something seems impossible to do, then you might have the wrong tool. So the solution in your case is that the old XML is corrupt. To fix this, you can: 1. Create a second mapping (i.e. new classes, new mappings) and then write a tool that create the new object structure from the new mapping. 2. Use XSLT or some other simple XML transformer to convert the old format into the new one. Simple can't do this for you since it uses annotations to configure the parsing process and in Java, each field/class/method can have only one annotation. Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ |