When using simple-xml, is there a way to let it ignore the nodes it does not recognize?
Yes. If you annotate your class with @Root(strict=false)
it will ignore any elements that are not mapped. See the documentation for additional details:
http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#loosemap
On a related note, you can also handle optional elements using @Element(required=false)
.
http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#optional
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With