XmlCursor sourceCursor = sourceDocument.newCursor();
sourceCursor.toFirstChild();
XmlQName sourceQName = (XmlQName) sourceCursor.getObject();
XmlObject targetDocument =
stl.parse(
"<any " + ns + " xsi:type='xs:QName'>" +
"</any>", null, null );
XmlCursor targetCursor = targetDocument.newCursor();
targetCursor.toFirstChild();
XmlQName targetQName = (XmlQName) targetCursor.getObject();
targetQName.set( sourceQName );
Assert.assertTrue(
targetQName.qNameValue().getNamespaceURI().equals( "xxx.com" ) );
//
// Test the set_text function on XmlQNameImpl
//
targetDocument =
stl.parse(
"<any " + ns + " xsi:type='xs:QName' xmlns:xxx='xxx.com'>" +
"</any>", null, null );
targetCursor = targetDocument.newCursor();
targetCursor.toFirstChild();
targetQName = (XmlQName) targetCursor.getObject();
try
{
targetQName.set( "zzz:abc" );
Assert.assertTrue( false ); // Must fail
}
catch ( Throwable t )
{
}
targetQName.set( "xxx:abc" );
Assert.assertTrue(
targetQName.qNameValue().getNamespaceURI().equals( "xxx.com" ) );
}