/** * Constructs an XMLString structure with copies of the values in * the given structure. * <p> * <strong>Note:</strong> This does not copy the character array; * only the reference to the array is copied. * * @param string The XMLString to copy. */ public XMLString(XMLString string) { setValues(string); } // <init>(XMLString)
/** * Constructs an XMLString structure preset with the specified * values. * * @param ch The character array. * @param offset The offset into the character array. * @param length The length of characters from the offset. */ public XMLString(char[] ch, int offset, int length) { setValues(ch, offset, length); } // <init>(char[],int,int)
/** * Initializes the contents of the XMLString structure with copies * of the given string structure. * <p> * <strong>Note:</strong> This does not copy the character array; * only the reference to the array is copied. * * @param s */ public void setValues(XMLString s) { setValues(s.ch, s.offset, s.length); } // setValues(XMLString)
private void fillXMLString(XMLString toFill, String str) { final int length = str.length(); final char[] strArray; if (length <= fCharBuffer.length) { str.getChars(0, length, fCharBuffer, 0); strArray = fCharBuffer; } else { strArray = str.toCharArray(); } toFill.setValues(strArray, 0, length); }
private void fillProcessingInstruction(String data) { final int dataLength = data.length(); char [] charBuffer = fCharBuffer; if (charBuffer.length < dataLength) { // toCharArray() creates a newly allocated array, so it's okay // to keep a reference to it. charBuffer = data.toCharArray(); } else { data.getChars(0, dataLength, charBuffer, 0); } fTempString.setValues(charBuffer, 0, dataLength); }
private void fillXMLString(XMLString toFill, String str) { final int length; final char[] strArray; if (str != null) { length = str.length(); if (length <= fCharBuffer.length) { str.getChars(0, length, fCharBuffer, 0); strArray = fCharBuffer; } else { strArray = str.toCharArray(); } } else { length = 0; strArray = new char[0]; } toFill.setValues(strArray, 0, length); } }
private NbspRemover() { nbspXMLString = new XMLString(); char[] c = {'&', 'n', 'b', 's', 'p', ';'}; nbspXMLString.setValues(c, 0, 6); }
public void processingInstruction(String target, String data) throws SAXException { // The XSD 1.0 validator does nothing with processing instructions so bypass it unless it's 1.1. if (fIsXSD11) { if (data != null) { fTempString.setValues(data.toCharArray(), 0, data.length()); } else { fTempString.setValues(new char[0], 0, 0); } fSchemaValidator.processingInstruction(target, fTempString, null); } // Send the processing instruction event directly to the application's ContentHandler. if (fContentHandler != null) { fContentHandler.processingInstruction(target, data); } }
private NbspRemover() { nbspXMLString = new XMLString(); char[] c = {'&', 'n', 'b', 's', 'p', ';'}; nbspXMLString.setValues(c, 0, 6); }
private void sendCharactersToValidator(String str) { if (str != null) { final int length = str.length(); final int remainder = length & CHUNK_MASK; if (remainder > 0) { str.getChars(0, remainder, fCharBuffer, 0); fTempString.setValues(fCharBuffer, 0, remainder); fSchemaValidator.characters(fTempString, null); } int i = remainder; while (i < length) { str.getChars(i, i += CHUNK_SIZE, fCharBuffer, 0); fTempString.setValues(fCharBuffer, 0, CHUNK_SIZE); fSchemaValidator.characters(fTempString, null); } } }
/** * Character content * * @param text The content * @param augs Additional information that may include infoset augmentations * @throws XNIException Thrown by handler to signal an error */ @Override public void characters(XMLString text, Augmentations augs) throws XNIException { if (entityName != null) { char[] charArray = entityName.toCharArray(); text.setValues(charArray, 0, charArray.length); entityName = null; } super.characters(text, augs); }
/** Send characters to the validator in CHUNK_SIZE character chunks. */ private void sendCharactersToValidator(String str) { if (str != null) { final int length = str.length(); final int remainder = length & CHUNK_MASK; if (remainder > 0) { str.getChars(0, remainder, fCharBuffer, 0); fTempString.setValues(fCharBuffer, 0, remainder); fSchemaValidator.characters(fTempString, null); } int i = remainder; while (i < length) { str.getChars(i, i += CHUNK_SIZE, fCharBuffer, 0); fTempString.setValues(fCharBuffer, 0, CHUNK_SIZE); fSchemaValidator.characters(fTempString, null); } } }
/** * <p> * processText * </p> * * @param tag * @param text */ protected void processText(String tag, XMLString text) { String convertedText = rewriter.enterConvertTextEvent(tag, new String(text.ch, text.offset, text.length)); if (convertedText != null) { char [] convertedTextChars = convertedText.toCharArray(); text.setValues(convertedTextChars, 0, convertedTextChars.length); } } }
public void comment(char[] ch, int start, int length) throws SAXException { // The XSD 1.0 validator does nothing with comments so bypass it unless it's 1.1. if (fIsXSD11) { fTempString.setValues(ch, start, length); fSchemaValidator.comment(fTempString, null); } // Send the comment event directly to the application's LexicalHandler. if (fLexicalHandler != null) { fLexicalHandler.comment(ch, start, length); } }
public void processingInstruction(String target, String data) throws SAXException { try { fTempString.setValues(data.toCharArray(), 0, data.length()); fSchemaDOMParser.processingInstruction(target, fTempString, null); } catch (XMLParseException e) { convertToSAXParseException(e); } catch (XNIException e) { convertToSAXException(e); } }
public void characters(char[] ch, int start, int length) throws SAXException { try { fTempString.setValues(ch, start, length); fSchemaDOMParser.characters(fTempString, null); } catch (XMLParseException e) { convertToSAXParseException(e); } catch (XNIException e) { convertToSAXException(e); } }
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { try { fTempString.setValues(ch, start, length); fSchemaDOMParser.ignorableWhitespace(fTempString, null); } catch (XMLParseException e) { convertToSAXParseException(e); } catch (XNIException e) { convertToSAXException(e); } }
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { try { fTempString.setValues(ch, start, length); fSchemaValidator.ignorableWhitespace(fTempString, null); } catch (XMLParseException e) { throw Util.toSAXParseException(e); } catch (XNIException e) { throw Util.toSAXException(e); } }
public void characters(char[] ch, int start, int length) throws SAXException { try { fTempString.setValues(ch, start, length); fSchemaValidator.characters(fTempString, null); } catch (XMLParseException e) { throw Util.toSAXParseException(e); } catch (XNIException e) { throw Util.toSAXException(e); } }
/** * Calls document handler with a single character resulting from * built-in entity resolution. * * @param c * @param entity built-in name */ private void handleCharacter(char c, String entity) throws XNIException { if (fDocumentHandler != null) { if (fNotifyBuiltInRefs) { fDocumentHandler.startGeneralEntity(entity, null, null, null); } fSingleChar[0] = c; fTempString.setValues(fSingleChar, 0, 1); fDocumentHandler.characters(fTempString, null); if (fNotifyBuiltInRefs) { fDocumentHandler.endGeneralEntity(entity, null); } } } // handleCharacter(char)