* @return True if the document root is accepted; false if it is not accepted.
*/
public boolean acceptRootElement(String sURI, String sLocalName, Attributes attributes, boolean bError)
{
MessagePart part = m_stack.getTopMessagePart();
RootXMLMessagePartMapping rootMapping;
if (part == null)
{
// Identify the XML message being parsed
Message msg = (Message)m_messageMap.get(sURI, sLocalName);
if (msg != null)
{
part = msg.getRoot();
}
if (part == null)
{
if (bError)
{
throw new IntegrationException("err.integration.xml.unsupportedMessage",
new Object[]{sURI, sLocalName});
}
return false;
}
rootMapping = (RootXMLMessagePartMapping)part.getMapping();
assert m_stack.getSize() == 1;
m_stack.setTopMessagePart(part);
m_stack.setTopBaseMessagePart(part);
if (s_logger.isDebugEnabled())
{
s_logger.debug("Identified the XML message as \"" + part.getName() + "\"");
}
((TransferObject)m_stack.getTopObject()).setClassName(part.getName());
m_headerPart = rootMapping.getHeaderPart();
m_bRestart = (rootMapping.getSchemaResourceMap() != null) || (m_headerPart != null);
m_baseRootPart = part;
}
else
{
// Verify root element of message being parsed
rootMapping = (RootXMLMessagePartMapping)part.getMapping();
if (!matches(m_baseRootPart, sURI, sLocalName))
{
if (bError)
{
throw new IntegrationException("err.integration.xml.invalidDocRoot",
new Object[]{sURI, sLocalName});
}
return false;
}
if (m_headerPart != rootMapping.getHeaderPart())
{
m_headerPart = rootMapping.getHeaderPart();
m_bRestart = true;
}
}
TransferObject tobj = (TransferObject)m_stack.getTopObject();
if (!m_bRestart)
{
parseAttributes(tobj, (CompositeMessagePart)part, attributes);
}
Message derivedMessage = getDerivedMessage(attributes, rootMapping, part.getFullPath());
Message primaryMessage = rootMapping.getRootMessage();
tobj.setClassName(primaryMessage.getName());
if (derivedMessage != null)
{
CompositeMessagePart derivedMessageRoot = derivedMessage.getRoot();
RootXMLMessagePartMapping derivedMessageRootMapping = (RootXMLMessagePartMapping)derivedMessageRoot.getMapping();
Message.validatePolymorphism(primaryMessage, derivedMessage, derivedMessageRoot);
m_stack.setTopBaseMessagePart(part);
part = derivedMessageRoot;
m_stack.setTopMessagePart(part);
tobj.setClassName(derivedMessage.getName());
MessagePart headerPart = derivedMessageRootMapping.getHeaderPart();
if (m_headerPart != headerPart)
{
m_headerPart = headerPart;
m_bRestart = true;