protected Element unmarshalElement() throws JiBXException, IOException {
// start by creating the actual element
QName qname = QName.get(m_unmarshalContext.getName(),
m_unmarshalContext.getPrefix(), m_unmarshalContext.getNamespace());
Element element = s_factory.createElement(qname);
// add all namespace declarations to element
int ncount = m_unmarshalContext.getNamespaceCount();
for (int i = 0; i < ncount; i++) {
String prefix = m_unmarshalContext.getNamespacePrefix(i);
String uri = m_unmarshalContext.getNamespaceUri(i);
element.addNamespace(prefix, uri);
}
// add all attributes to element
int acount = m_unmarshalContext.getAttributeCount();
for (int i = 0; i < acount; i++) {
String prefix = m_unmarshalContext.getAttributePrefix(i);
String uri = m_unmarshalContext.getAttributeNamespace(i);
String name = m_unmarshalContext.getAttributeName(i);
String value = m_unmarshalContext.getAttributeValue(i);
qname = QName.get(name, prefix, uri);
element.addAttribute(qname, value);
}
// add all content to element
int event = m_unmarshalContext.nextToken();
if (event != IXMLReader.END_TAG) {
unmarshalContent(element.content());
}
m_unmarshalContext.nextToken();
return element;
}