private XMLField getFieldForName(String localName, String namespaceUri) {
Iterator fields = getFields().iterator();
while(fields.hasNext()) {
XMLField nextField = (XMLField)fields.next();
XPathFragment fragment = nextField.getXPathFragment();
while(fragment != null && (!fragment.nameIsText())) {
if(fragment.getNextFragment() == null || fragment.getHasText()) {
if(fragment.getLocalName().equals(localName)) {
String fragUri = fragment.getNamespaceURI();
if((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
return nextField;