public static final void isXMLCharWF(DOMErrorHandler errorHandler,DOMErrorImpl error,DOMLocatorImpl locator,String datavalue,boolean isXML11Version){
  if (datavalue == null || (datavalue.length() == 0)) {
    return;
  }
  char[] dataarray=datavalue.toCharArray();
  int datalength=dataarray.length;
  if (isXML11Version) {
    int i=0;
    while (i < datalength) {
      if (XML11Char.isXML11Invalid(dataarray[i++])) {
        char ch=dataarray[i - 1];
        if (XMLChar.isHighSurrogate(ch) && i < datalength) {
          char ch2=dataarray[i++];
          if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch,ch2))) {
            continue;
          }
        }
        String msg=DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,"InvalidXMLCharInDOM",new Object[]{Integer.toString(dataarray[i - 1],16)});
        reportDOMError(errorHandler,error,locator,msg,DOMError.SEVERITY_ERROR,"wf-invalid-character");
      }
    }
  }
 else {
    int i=0;
    while (i < datalength) {
      if (XMLChar.isInvalid(dataarray[i++])) {
        char ch=dataarray[i - 1];
        if (XMLChar.isHighSurrogate(ch) && i < datalength) {
          char ch2=dataarray[i++];
          if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental(XMLChar.supplemental(ch,ch2))) {
            continue;
          }
        }
        String msg=DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,"InvalidXMLCharInDOM",new Object[]{Integer.toString(dataarray[i - 1],16)});
        reportDOMError(errorHandler,error,locator,msg,DOMError.SEVERITY_ERROR,"wf-invalid-character");
      }
    }
  }
}

public static final void isXMLCharWF ( DOMErrorHandler errorHandler , DOMErrorImpl error , DOMLocatorImpl locator , String datavalue , boolean isXML11Version ) { if ( datavalue == null || ( datavalue . length ( ) == 0 ) ) { return ; } char [ ] dataarray = datavalue . toCharArray ( ) ; int datalength = dataarray . length ; if ( isXML11Version ) { int i = 0 ; while ( i < datalength ) { if ( XML11Char . isXML11Invalid ( dataarray [ i ++ ] ) ) { char ch = dataarray [ i - 1 ] ; if ( XMLChar . isHighSurrogate ( ch ) && i < datalength ) { char ch2 = dataarray [ i ++ ] ; if ( XMLChar . isLowSurrogate ( ch2 ) && XMLChar . isSupplemental ( XMLChar . supplemental ( ch , ch2 ) ) ) { continue ; } } String msg = DOMMessageFormatter . formatMessage ( DOMMessageFormatter . DOM_DOMAIN , "InvalidXMLCharInDOM" , new Object [ ] { Integer . toString ( dataarray [ i - 1 ] , 16 ) } ) ; reportDOMError ( errorHandler , error , locator , msg , DOMError . SEVERITY_ERROR , "wf-invalid-character" ) ; } } } else { int i = 0 ; while ( i < datalength ) { if ( XMLChar . isInvalid ( dataarray [ i ++ ] ) ) { char ch = dataarray [ i - 1 ] ; if ( XMLChar . isHighSurrogate ( ch ) && i < datalength ) { char ch2 = dataarray [ i ++ ] ; if ( XMLChar . isLowSurrogate ( ch2 ) && XMLChar . isSupplemental ( XMLChar . supplemental ( ch , ch2 ) ) ) { continue ; } } String msg = DOMMessageFormatter . formatMessage ( DOMMessageFormatter . DOM_DOMAIN , "InvalidXMLCharInDOM" , new Object [ ] { Integer . toString ( dataarray [ i - 1 ] , 16 ) } ) ; reportDOMError ( errorHandler , error , locator , msg , DOMError . SEVERITY_ERROR , "wf-invalid-character" ) ; } } } }
non - dom : check for valid xml characters as per the xml version
