{
TransferObject root;
Message message = m_context.getMetadata().getMessage("XMLAnyTest");
// Parse child1
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<child1>" +
"<b>23</b>" +
"<c1>31</c1>" +
"</child1>" +
"</anyInterfaceInheritanceElement>" +
"</XMLAnyTest>"), message);
assertEquals("XMLAnyTest", root.getClassName());
root = (TransferObject)root.getValue("anyInterfaceInheritanceElement");
assertEquals("XML_Inherit_Child1", root.getClassName());
assertEquals(Primitive.createInteger(23), root.getValue("b"));
assertEquals(Primitive.createInteger(31), root.getValue("c1"));
// Parse child2
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<child2>" +
"<a>Avalue</a>" +
"<b>Bvalue</b>" +
"</child2>" +
"</anyInterfaceInheritanceElement>" +
"</XMLAnyTest>"), message);
assertEquals("XMLAnyTest", root.getClassName());
root = (TransferObject)root.getValue("anyInterfaceInheritanceElement");
assertEquals("XML_Inherit_Child2", root.getClassName());
assertEquals("Avalue", root.getValue("a"));
assertEquals("Bvalue", root.getValue("b"));
// Cannot parse child3 on its own. (it has same root element name as its parent)
// Parse parent
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<parent>" +
"<a>Avalue</a>" +
"<b>11</b>" +
"</parent>" +
"</anyInterfaceInheritanceElement>" +
"</XMLAnyTest>"), message);
assertEquals("XMLAnyTest", root.getClassName());
root = (TransferObject)root.getValue("anyInterfaceInheritanceElement");
assertEquals("XML_Inherit_Parent", root.getClassName());
assertEquals("Avalue", root.getValue("a"));
assertEquals(Primitive.createInteger(11), root.getValue("b"));
// Parse parent/child1
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<parent xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Child1Type\">" +
"<b>23</b>" +
"<c1>31</c1>" +
"</parent>" +
"</anyInterfaceInheritanceElement>" +
"</XMLAnyTest>"), message);
assertEquals("XMLAnyTest", root.getClassName());
root = (TransferObject)root.getValue("anyInterfaceInheritanceElement");
assertEquals("XML_Inherit_Child1", root.getClassName());
assertEquals(Primitive.createInteger(23), root.getValue("b"));
assertEquals(Primitive.createInteger(31), root.getValue("c1"));
// Parse parent/child2
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<parent xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Child2Type\">" +
"<a>Avalue</a>" +
"<b>Bvalue</b>" +
"</parent>" +
"</anyInterfaceInheritanceElement>" +
"</XMLAnyTest>"), message);
assertEquals("XMLAnyTest", root.getClassName());
root = (TransferObject)root.getValue("anyInterfaceInheritanceElement");
assertEquals("XML_Inherit_Child2", root.getClassName());
assertEquals("Avalue", root.getValue("a"));
assertEquals("Bvalue", root.getValue("b"));
// Parse parent/child3
root = m_parser.parse(new StringInput(
"<XMLAnyTest>" +
"<anyInterfaceInheritanceElement>" +
"<parent xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Child3Type\">" +
"<a>Avalue</a>" +
"<b>Bvalue</b>" +