Hi,
have you got a test case that I could use to debug your problem ? If
yes, please create a new Jira issue and attach the test case (including
all required files).
Kind Regards
Werner Guttmann
On 17.09.2011 12:31, [email protected] wrote:
Hello,
I have a question about marshalling raw xml segments.
With reference to the example at:
http://www.castor.org/how-to-unmarshal-raw-xml.html
What I want is the xml fragment
"<misc>Misc xml to be dealt with later</misc>"
The example gives a result that includes the parent element "xmlnode2"
So with the requirement that the fragment could be any element.
How do I get only the fragment I want.
Furthermore the xml I have to unmarshall is more like the following:
<root xmlns="nsouter">
<xmlnode attribute="misc xml data">
<data>Data 1</data>
<data>Data 2</data>
</xmlnode>
<string>Regular String Data</string>
<xmlnode2>
<misc xmlns="nsinner">Misc xml to be dealt with later</misc>
</xmlnode2>
</root>
I need to unmarshall the fragment:
"<misc xmlns="nsinner">Misc xml to be dealt with later</misc>"
with the right namespace
I have tried to adjust the FieldHandler:
public Object convertUponSet(final Object value)
{
AnyNode result = null;
final AnyNode node = (AnyNode) value;
if (node != null)
{
result = node.getFirstChild();
if (result.getNodeType() != AnyNode.ELEMENT)
{
result = result.getNextSibling();
}
}
if (result == null || result.getNodeType() != AnyNode.ELEMENT)
{
throw new BindingRuntimeException("failed to extract the Message Body
xml segment");
}
return result.toString();
}
But result = node.getFirstChild(); gives me an AnyNode that has the same
namespace of the parent (nsouter) ?
Greetings,
Huub
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email