XMLSplitterSerialisationHelper { public static TypeDescriptor extensionXMLToTypeDescriptor(Element element) { Element child = (Element) element.getChildren().get(0); return buildTypeDescriptorFromElement(child, new HashMap<String, TypeDescriptor>()); }  static Element typeDescriptorToExtensionXML(TypeDescriptor descriptor); static TypeDescriptor extensionXMLToTypeDescriptor(Element element); final static Namespace XScuflNS; }
@Test public void testCyclicFromElement() throws Exception { String xml = "<s:extensions xmlns:s=\"http: Element el = new SAXBuilder().build(new StringReader(xml)) .getRootElement(); TypeDescriptor a = XMLSplitterSerialisationHelper .extensionXMLToTypeDescriptor(el); assertTrue("wrong type", a instanceof ComplexTypeDescriptor); assertEquals("wrong name", "a", a.getName()); List<TypeDescriptor> a_elements = ((ComplexTypeDescriptor) a).getElements(); assertEquals("should be only 1 element", 1, a_elements.size()); TypeDescriptor b = a_elements.get(0); assertTrue("wrong type", b instanceof ComplexTypeDescriptor); List<TypeDescriptor> b_elements = ((ComplexTypeDescriptor) b).getElements(); assertEquals("should be only 1 element", 1, b_elements.size()); assertEquals("b should contain a reference to a", a.toString(), b_elements.get(0).toString()); }
@Test public void testCorrectQName() throws Exception { TypeDescriptor desc = XMLSplitterSerialisationHelper .extensionXMLToTypeDescriptor(new SAXBuilder().build( new StringReader(eInfoXML())).getRootElement()); assertEquals("NamespaceURI is incorrect", "http: .getQname().getNamespaceURI()); assertEquals("Localpart is incorrect", "eSpellRequest", desc.getQname() .getLocalPart()); }