final String schemaSource1 =
"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test.com/namespaces'>\n" +
" <xs:element name='foo' type='xs:string'/>\n" +
"</xs:schema>\n";
JAXBParser parser = newJAXBParser();
InputSource isource = new InputSource(new StringReader(schemaSource1));
isource.setSystemId("testTargetNamespace1.xsd");
XSSchema schema = parser.parse(isource);
XSElement[] schemaElements = schema.getElements();
assertEquals(1, schemaElements.length);
assertEquals(new XsQName("http://test.com/namespaces", "foo"), schemaElements[0].getName());
assertNull(schemaElements[0].getName().getPrefix());
final String schemaSource2 =
"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:test='http://test.com/namespaces'" +
" targetNamespace='http://test.com/namespaces'>\n" +
" <xs:element name='foo' type='xs:string'/>\n" +
"</xs:schema>\n";
parser = newJAXBParser();
isource = new InputSource(new StringReader(schemaSource2));
isource.setSystemId("testTargetNamespace1.xsd");
schema = parser.parse(isource);
schemaElements = schema.getElements();
assertEquals(1, schemaElements.length);
assertEquals(new XsQName("http://test.com/namespaces", "foo"), schemaElements[0].getName());
assertEquals("test", schemaElements[0].getName().getPrefix());