Java Code Examples for javax.xml.bind.Binder#getJAXBNode()
The following examples show how to use
javax.xml.bind.Binder#getJAXBNode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityTokenServiceProvider.java From steady with Apache License 2.0 | 5 votes |
private void walkDom(String pfx, Element element, Binder<Node> binder, Object parent) { try { Object o = binder.getJAXBNode(element); if (o instanceof JAXBElement) { o = ((JAXBElement<?>)o).getValue(); } //System.out.println(pfx + DOMUtils.getElementQName(element) + " -> " // + (o == null ? "null" : o.getClass())); if (o == null && parent != null) { // if it's not able to bind to an object, it's possibly an xsd:any // we'll check the parent for the standard "any" and replace with // the original element. Field f = parent.getClass().getDeclaredField("any"); if (f.getAnnotation(XmlAnyElement.class) != null) { Object old = ReflectionUtil.setAccessible(f).get(parent); if (old instanceof Element && DOMUtils.getElementQName(element).equals(DOMUtils.getElementQName((Element)old))) { ReflectionUtil.setAccessible(f).set(parent, element); } } } if (o == null) { return; } Node nd = element.getFirstChild(); while (nd != null) { if (nd instanceof Element) { walkDom(pfx + " ", (Element)nd, binder, o); } nd = nd.getNextSibling(); } } catch (Throwable t) { //ignore -this is a complete hack anyway } }
Example 2
Source File: SecurityTokenServiceProvider.java From steady with Apache License 2.0 | 5 votes |
private void walkDom(String pfx, Element element, Binder<Node> binder, Object parent) { try { Object o = binder.getJAXBNode(element); if (o instanceof JAXBElement) { o = ((JAXBElement<?>)o).getValue(); } //System.out.println(pfx + DOMUtils.getElementQName(element) + " -> " // + (o == null ? "null" : o.getClass())); if (o == null && parent != null) { // if it's not able to bind to an object, it's possibly an xsd:any // we'll check the parent for the standard "any" and replace with // the original element. Field f = parent.getClass().getDeclaredField("any"); if (f.getAnnotation(XmlAnyElement.class) != null) { Object old = ReflectionUtil.setAccessible(f).get(parent); if (old instanceof Element && DOMUtils.getElementQName(element).equals(DOMUtils.getElementQName((Element)old))) { ReflectionUtil.setAccessible(f).set(parent, element); } } } if (o == null) { return; } Node nd = element.getFirstChild(); while (nd != null) { if (nd instanceof Element) { walkDom(pfx + " ", (Element)nd, binder, o); } nd = nd.getNextSibling(); } } catch (Throwable t) { //ignore -this is a complete hack anyway } }
Example 3
Source File: SecurityTokenServiceProvider.java From steady with Apache License 2.0 | 5 votes |
private void walkDom(String pfx, Element element, Binder<Node> binder, Object parent) { try { Object o = binder.getJAXBNode(element); if (o instanceof JAXBElement) { o = ((JAXBElement<?>)o).getValue(); } //System.out.println(pfx + DOMUtils.getElementQName(element) + " -> " // + (o == null ? "null" : o.getClass())); if (o == null && parent != null) { // if it's not able to bind to an object, it's possibly an xsd:any // we'll check the parent for the standard "any" and replace with // the original element. Field f = parent.getClass().getDeclaredField("any"); if (f.getAnnotation(XmlAnyElement.class) != null) { Object old = ReflectionUtil.setAccessible(f).get(parent); if (old instanceof Element && DOMUtils.getElementQName(element).equals(DOMUtils.getElementQName((Element)old))) { ReflectionUtil.setAccessible(f).set(parent, element); } } } if (o == null) { return; } Node nd = element.getFirstChild(); while (nd != null) { if (nd instanceof Element) { walkDom(pfx + " ", (Element)nd, binder, o); } nd = nd.getNextSibling(); } } catch (Throwable t) { //ignore -this is a complete hack anyway } }
Example 4
Source File: SecurityTokenServiceProvider.java From steady with Apache License 2.0 | 5 votes |
private void walkDom(String pfx, Element element, Binder<Node> binder, Object parent) { try { Object o = binder.getJAXBNode(element); if (o instanceof JAXBElement) { o = ((JAXBElement<?>)o).getValue(); } //System.out.println(pfx + DOMUtils.getElementQName(element) + " -> " // + (o == null ? "null" : o.getClass())); if (o == null && parent != null) { // if it's not able to bind to an object, it's possibly an xsd:any // we'll check the parent for the standard "any" and replace with // the original element. Field f = parent.getClass().getDeclaredField("any"); if (f.getAnnotation(XmlAnyElement.class) != null) { Object old = ReflectionUtil.setAccessible(f).get(parent); if (old instanceof Element && DOMUtils.getElementQName(element).equals(DOMUtils.getElementQName((Element)old))) { ReflectionUtil.setAccessible(f).set(parent, element); } } } if (o == null) { return; } Node nd = element.getFirstChild(); while (nd != null) { if (nd instanceof Element) { walkDom(pfx + " ", (Element)nd, binder, o); } nd = nd.getNextSibling(); } } catch (Throwable t) { //ignore -this is a complete hack anyway } }
Example 5
Source File: SecurityTokenServiceProvider.java From cxf with Apache License 2.0 | 5 votes |
private void walkDom(String pfx, Element element, Binder<Node> binder, Object parent) { try { Object o = binder.getJAXBNode(element); if (o instanceof JAXBElement) { o = ((JAXBElement<?>)o).getValue(); } //System.out.println(pfx + DOMUtils.getElementQName(element) + " -> " // + (o == null ? "null" : o.getClass())); if (o == null && parent != null) { // if it's not able to bind to an object, it's possibly an xsd:any // we'll check the parent for the standard "any" and replace with // the original element. Field f = parent.getClass().getDeclaredField("any"); if (f.getAnnotation(XmlAnyElement.class) != null) { Object old = ReflectionUtil.setAccessible(f).get(parent); if (old instanceof Element && DOMUtils.getElementQName(element).equals(DOMUtils.getElementQName((Element)old))) { ReflectionUtil.setAccessible(f).set(parent, element); } } } if (o == null) { return; } Node nd = element.getFirstChild(); while (nd != null) { if (nd instanceof Element) { walkDom(pfx + " ", (Element)nd, binder, o); } nd = nd.getNextSibling(); } } catch (Throwable t) { //ignore -this is a complete hack anyway } }