org.apache.xerces.xni.XMLString Java Examples

The following examples show how to use org.apache.xerces.xni.XMLString. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLModelHandler.java    From lemminx with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException {
	if (XMLModelConstants.XML_MODEL_PI.equals(target)) {
		XMLModelDeclaration model = XMLModelDeclaration.parse(data);
		XMLModelValidator validator = createValidator(model);
		if (validator != null) {
			validator.reset(configuration);
			validator.setHref(model.getHref());
			if (xmlModelValidators == null) {
				xmlModelValidators = new ArrayList<>();
			}
			xmlModelValidators.add(validator);
		}
	}

	if (documentHandler != null) {
		documentHandler.processingInstruction(target, data, augs);
	}
}
 
Example #2
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private int isUnchangedByNormalization(XMLString value) {
	int end = value.offset + value.length;
	for (int i = value.offset; i < end; ++i) {
		int c = value.ch[i];
		// Performance: For XML 1.0 documents take advantage of
		// the fact that the only legal characters below 0x20
		// are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've
		// already determined the well-formedness of these
		// characters it is sufficient (and safe) to check
		// against 0x20. -- mrglavas
		if (c < 0x20) {
			return i - value.offset;
		}
	}
	return -1;
}
 
Example #3
Source File: CorrectWriter.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void write(XMLString content) throws IOException, RepairableException {
	if (stack.fSize == 0) {
		return;
	}
	QName tq = new QName();
	stack.lastElement(tq);
	record.textAccept = schema.isTextAccept(tq, content);
	if (record.textAccept) {
		record.xmls.append(content);
	} else {
		record.textAccept = false;
		record.xmls.clear();
		record.tuset = false;
		throw new RepairableException(
				MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.autofix.errorcode"), tq.rawname, ""));
	}
}
 
Example #4
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private int isUnchangedByNormalization(XMLString value) {
	int end = value.offset + value.length;
	for (int i = value.offset; i < end; ++i) {
		int c = value.ch[i];
		// Performance: For XML 1.0 documents take advantage of
		// the fact that the only legal characters below 0x20
		// are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've
		// already determined the well-formedness of these
		// characters it is sufficient (and safe) to check
		// against 0x20. -- mrglavas
		if (c < 0x20) {
			return i - value.offset;
		}
	}
	return -1;
}
 
Example #5
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private void normalizeWhitespace(XMLString value, int fromIndex) {
	int end = value.offset + value.length;
	for (int i = value.offset + fromIndex; i < end; ++i) {
		int c = value.ch[i];
		// Performance: For XML 1.0 documents take advantage of
		// the fact that the only legal characters below 0x20
		// are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've
		// already determined the well-formedness of these
		// characters it is sufficient (and safe) to check
		// against 0x20. -- mrglavas
		if (c < 0x20) {
			if (c == 0x09 || c == 0x0d || c == 0x0a) {
				continue;
			}
			value.ch[i] = ' ';
			illegalCharacter = true;
		}
	}
}
 
Example #6
Source File: XMLModelHandler.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void comment(XMLString text, Augmentations augs) throws XNIException {
	if (xmlModelValidators != null) {
		for (XMLModelValidator validator : xmlModelValidators) {
			validator.comment(text, augs);
		}
	}

	if (documentHandler != null) {
		documentHandler.comment(text, augs);
	}
}
 
Example #7
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void normalizeWhitespace(XMLString value) {
	int end = value.offset + value.length;
	for (int i = value.offset; i < end; ++i) {
		int c = value.ch[i];
		// Performance: For XML 1.0 documents take advantage of
		// the fact that the only legal characters below 0x20
		// are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've
		// already determined the well-formedness of these
		// characters it is sufficient (and safe) to check
		// against 0x20. -- mrglavas
		if (c < 0x20) {
			value.ch[i] = ' ';
		}
	}
}
 
Example #8
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void normalizeWhitespace(XMLString value, int fromIndex) {
	int end = value.offset + value.length;
	for (int i = value.offset + fromIndex; i < end; ++i) {
		int c = value.ch[i];
		// Performance: For XML 1.0 documents take advantage of
		// the fact that the only legal characters below 0x20
		// are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've
		// already determined the well-formedness of these
		// characters it is sufficient (and safe) to check
		// against 0x20. -- mrglavas
		if (c < 0x20) {
			value.ch[i] = ' ';
		}
	}
}
 
Example #9
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean scanPubidLiteral(XMLString literal) throws TmxEndEntityException, IOException, RepairableException {
	int quote = entityScanner.scanChar();
	if (quote != '\'' && quote != '"') {
		newRepairableException("QuoteRequiredInPublicID");
		return false;
	}

	fStringBuffer.clear();
	// skip leading whitespace
	boolean skipSpace = true;
	boolean dataok = true;
	while (true) {
		int c = entityScanner.scanChar();
		if (c == ' ' || c == '\n' || c == '\r') {
			if (!skipSpace) {
				// take the first whitespace as a space and skip the others
				fStringBuffer.append(' ');
				skipSpace = true;
			}
		} else if (c == quote) {
			if (skipSpace) {
				// if we finished on a space let's trim it
				fStringBuffer.length--;
			}
			literal.setValues(fStringBuffer);
			break;
		} else if (XMLChar.isPubid(c)) {
			fStringBuffer.append((char) c);
			skipSpace = false;
		} else if (c == -1) {
			newRepairableException("PublicIDUnterminated");
			return false;
		} else {
			dataok = false;
			newRepairableException("InvalidCharInPublicID");
		}
	}
	return dataok;
}
 
Example #10
Source File: TmxSchema.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean isTextAccept(QName qname, XMLString content) {
	boolean spaces = true;
	for (int i = content.offset; i < content.offset + content.length; i++) {
		spaces = spaces &&  XMLChar.isSpace(content.ch[i]);
	}
	if (spaces) {
		return true;
	}
	return acceptText.containsSymbol(qname.rawname);
}
 
Example #11
Source File: ScriptFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void characters( XMLString text, Augmentations augs ) throws XNIException {
    if (_activeScriptBlock != null) {
        _activeScriptBlock.append( text.ch, text.offset, text.length );
    } else {
        super.characters( text, augs );
    }
}
 
Example #12
Source File: NekoHtmlDocumentHandler.java    From gate-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void ignorableWhitespace(XMLString arg0, Augmentations arg1)
        throws XNIException {
  if(DEBUG_UNUSED) {
    Out.println("ignorableWhitespace: " + arg0);
  }
}
 
Example #13
Source File: XMLModelHandler.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void characters(XMLString text, Augmentations augs) throws XNIException {
	if (xmlModelValidators != null) {
		for (XMLModelValidator validator : xmlModelValidators) {
			validator.characters(text, augs);
		}
	}

	if (documentHandler != null) {
		documentHandler.characters(text, augs);
	}
}
 
Example #14
Source File: XMLModelHandler.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
	if (xmlModelValidators != null) {
		for (XMLModelValidator validator : xmlModelValidators) {
			validator.ignorableWhitespace(text, augs);
		}
	}

	if (documentHandler != null) {
		documentHandler.ignorableWhitespace(text, augs);
	}
}
 
Example #15
Source File: HTMLTagBalancer.java    From cc-dbp with Apache License 2.0 5 votes vote down vote up
/** Processing instruction. */
public void processingInstruction(String target, XMLString data,
                                  Augmentations augs) throws XNIException {
    fSeenAnything = true;
    consumeEarlyTextIfNeeded();
    if (fDocumentHandler != null) {
        fDocumentHandler.processingInstruction(target, data, augs);
    }
}
 
Example #16
Source File: HTMLTagBalancer.java    From cc-dbp with Apache License 2.0 5 votes vote down vote up
/** Comment. */
public void comment(XMLString text, Augmentations augs) throws XNIException {
    fSeenAnything = true;
    consumeEarlyTextIfNeeded();
    if (fDocumentHandler != null) {
        fDocumentHandler.comment(text, augs);
    }
}
 
Example #17
Source File: CMDTDDocument.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void internalEntityDecl(String name, XMLString text, XMLString nonNormalizedText, Augmentations augs)
		throws XNIException {
	super.internalEntityDecl(name, text, nonNormalizedText, augs);
	try {
		entities.add(new ScannedDTDEntityDecl(name, text.toString(), fEntityManager.getCurrentEntity()));
	} catch (Exception e) {
		LOGGER.log(Level.SEVERE, "Error while extracting information for the internal entity '" + name + "'", e);
	}
}
 
Example #18
Source File: CMDTDDocument.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void attributeDecl(String elementName, String attributeName, String type, String[] enumeration,
		String defaultType, XMLString defaultValue, XMLString nonNormalizedDefaultValue, Augmentations augs)
		throws XNIException {
	if (comment != null) {
		nodeInfo = new DTDNodeInfo();
		nodeInfo.setComment(comment);
		attributes.put(attributeName, nodeInfo);
	}
	super.attributeDecl(elementName, attributeName, type, enumeration, defaultType, defaultValue,
			nonNormalizedDefaultValue, augs);
}
 
Example #19
Source File: CMDTDDocument.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void comment(XMLString text, Augmentations augs) throws XNIException {
	if (text != null) {
		comment = text.toString();
	}
	super.comment(text, augs);
}
 
Example #20
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private void scanPIData(String target, XMLString xs) throws IOException, TmxEndEntityException {
	// check target
	if (target.length() == 3) {
		char c0 = Character.toLowerCase(target.charAt(0));
		char c1 = Character.toLowerCase(target.charAt(1));
		char c2 = Character.toLowerCase(target.charAt(2));
		if (c0 == 'x' && c1 == 'm' && c2 == 'l') {
			// TODO 非法命名
			return;
		}
	}
	// spaces
	if (!entityScanner.skipSpaces()) {
		if (entityScanner.skipString("?>")) {
			// we found the end, there is no data
			xs.clear();
			return;
		} else {
			if (entityScanner.peekChar() == ':') {
				entityScanner.scanChar();
				XMLStringBuffer colonName = new XMLStringBuffer(target);
				colonName.append(':');
				String str = entityScanner.scanName();
				if (str != null)
					colonName.append(str);
				// TODO reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()});
				entityScanner.skipSpaces();
			} else {
				// TODO reportFatalError("SpaceRequiredInPI", null);
			}
		}
	}

	fStringBuffer.clear();
	// data
	if (entityScanner.scanData("?>", fStringBuffer)) {
		do {
			int c = entityScanner.peekChar();
			if (c != -1) {
				if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer);
				} else if (XMLChar.isInvalid(c)) {
					// reportFatalError("InvalidCharInPI",
					// new Object[]{Integer.toHexString(c)});
					entityScanner.scanChar();
				}
			}
		} while (entityScanner.scanData("?>", fStringBuffer));
	}
	xs.setValues(fStringBuffer);
}
 
Example #21
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException {
	String name = entityScanner.scanName();
	if (name == null) {
		error("not found paseudo attribute");
	}
	entityScanner.skipDeclSpaces();
	if (!entityScanner.skipChar('=')) {
		error("not found '='");
	}
	entityScanner.skipDeclSpaces();
	int quote = entityScanner.peekChar();
	if (quote != '\'' && quote != '"') {
		error("not found quote when scan pseudo attribute");
	}
	entityScanner.scanChar();
	int c = entityScanner.scanLiteral(quote, value);
	if (c != quote) {
		fStringBuffer2.clear();
		do {
			fStringBuffer2.append(value);
			if (c != -1) {
				if (c == '&' || c == '%' || c == '<' || c == ']') {
					fStringBuffer2.append((char) entityScanner.scanChar());
				}
				// REVISIT: Even if you could reliably read non-ASCII chars
				// why bother scanning for surrogates here? Only ASCII chars
				// match the productions in XMLDecls and TextDecls. -- mrglavas
				else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer2);
				} else if (XMLChar.isInvalid(c)) {
					String key = scanningTextDecl ? "InvalidCharInTextDecl" : "InvalidCharInXMLDecl";
					error("invalid char '&#" + Integer.toHexString(c) + "'");
					// reportFatalError(key,
					// new Object[] {Integer.toString(c, 16)});
					entityScanner.scanChar();
				}
			}
			c = entityScanner.scanLiteral(quote, value);
		} while (c != quote);
		fStringBuffer2.append(value);
		value.setValues(fStringBuffer2);
	}
	if (!entityScanner.skipChar((char) quote)) {
		error("not found close quote");
	}

	// return
	return name;
}
 
Example #22
Source File: XMLModelDeclaration.java    From lemminx with Eclipse Public License 2.0 4 votes vote down vote up
public static XMLModelDeclaration parse(XMLString data) {
	return parse(data.ch, data.offset, data.length);
}
 
Example #23
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private void scanPIData(String target, XMLString xs) throws IOException {

		// check target
		if (target.length() == 3) {
			char c0 = Character.toLowerCase(target.charAt(0));
			char c1 = Character.toLowerCase(target.charAt(1));
			char c2 = Character.toLowerCase(target.charAt(2));
			if (c0 == 'x' && c1 == 'm' && c2 == 'l') {
				// TODO
				// reportFatalError("ReservedPITarget", null);
			}
		}

		// spaces
		if (!entityScanner.skipSpaces()) {
			if (entityScanner.skipString("?>")) {
				// we found the end, there is no data
				xs.clear();
				return;
			} else {
				if (entityScanner.peekChar() == ':') {
					entityScanner.scanChar();
					XMLStringBuffer colonName = new XMLStringBuffer(target);
					colonName.append(':');
					String str = entityScanner.scanName();
					if (str != null)
						colonName.append(str);
					// TODO
					// reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()});
					entityScanner.skipSpaces();
				} else {
					// TODO
					// if there is data there should be some space
					// reportFatalError("SpaceRequiredInPI", null);
				}
			}
		}

		fStringBuffer.clear();
		// data
		if (entityScanner.scanData("?>", fStringBuffer)) {
			do {
				int c = entityScanner.peekChar();
				if (c != -1) {
					if (XMLChar.isHighSurrogate(c)) {
						scanSurrogates(fStringBuffer);
					} else if (XMLChar.isInvalid(c)) {
						// reportFatalError("InvalidCharInPI",
						// new Object[]{Integer.toHexString(c)});
						entityScanner.scanChar();
					}
				}
			} while (entityScanner.scanData("?>", fStringBuffer));
		}
		xs.setValues(fStringBuffer);
	}
 
Example #24
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
int scanContent() throws IOException {

		XMLString content = fTempString;
		int c = entityScanner.scanContent(content);
		if (c == '\r') {
			// happens when there is the character reference &#13;
			entityScanner.scanChar();
			stringBuffer.clear();
			stringBuffer.append(content);
			stringBuffer.append((char) c);
			content = stringBuffer;
			c = -1;
		}

		String str = new String(content.ch, content.offset, content.length);
		if (str.trim().isEmpty()) {
			appendContent(str);
		} else {
			if (scope.isEmpty()) {
				return str.charAt(0);
			}
			String parent = scope.lastElement();
			if (parent.equals("note") || parent.equals("prop") || parent.equals("seg")) {
				appendContent(str);
			} else {
				errorCode.append(str);// 存储错误代码
				errorCode.setPosition(entityScanner.getLineNumber(), entityScanner.getColumnNumber());
				errorCode.setDescription(MessageFormat.format(
						Messages.getString("tmxeditor.tmxFileValidator.autofix.errorcode"), parent, str));
			}
		}

		if (c == ']' && fTempString.length == 0) {
			stringBuffer.clear();
			stringBuffer.append((char) entityScanner.scanChar());
			// remember where we are in case we get an endEntity before we
			// could flush the buffer out - this happens when we're parsing an
			// entity which ends with a ]
			// fInScanContent = true;
			//
			// We work on a single character basis to handle cases such as:
			// ']]]>' which we might otherwise miss.
			//
			if (entityScanner.skipChar(']')) {
				stringBuffer.append(']');
				while (entityScanner.skipChar(']')) {
					stringBuffer.append(']');
				}
				if (entityScanner.skipChar('>')) {

					// TODO
					// reportFatalError("CDEndInContent", null);
				}
			}
			// TODO
			// fInScanContent = false;
			c = -1;
		}
		return c;
	}
 
Example #25
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private void normalizeWhitespace(XMLString value) {
	normalizeWhitespace(value, 0);
}
 
Example #26
Source File: HTMLTagBalancer.java    From cc-dbp with Apache License 2.0 4 votes vote down vote up
/** Ignorable whitespace. */
public void ignorableWhitespace(XMLString text, Augmentations augs)
    throws XNIException {
    characters(text, augs);
}
 
Example #27
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException,
		RepairableException, TmxEndEntityException {
	String name = entityScanner.scanName();
	if (name.isEmpty()) {
		newRepairableException("not found Pseudo Attribute name", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.skipDeclSpaces();
	if (!entityScanner.skipChar('=')) {
		newRepairableException("not found '=' when scan Pseudo Attribute", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.skipDeclSpaces();
	int quote = entityScanner.peekChar();
	if (quote != '\'' && quote != '"') {
		newRepairableException("not found 'quote' when scan Pseudo Attribute", entityScanner.getLineNumber(),
				entityScanner.getOffsetNumber());
	}
	entityScanner.scanChar();
	int c = entityScanner.scanLiteral(quote, value);
	if (c != quote) {
		fStringBuffer2.clear();
		do {
			fStringBuffer2.append(value);
			if (c != -1) {
				if (c == '&' || c == '%' || c == '<' || c == ']') {
					fStringBuffer2.append((char) entityScanner.scanChar());
				}
				// REVISIT: Even if you could reliably read non-ASCII chars
				// why bother scanning for surrogates here? Only ASCII chars
				// match the productions in XMLDecls and TextDecls. -- mrglavas
				else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer2);
				} else if (XMLChar.isInvalid(c)) {
					entityScanner.scanChar();
					// TODO should we report error, or skip this char silence?
					// error("Invalid Char in xml declaration : '&#" + Integer.toHexString(c) + "'");
				}
			}
			c = entityScanner.scanLiteral(quote, value);
		} while (c != quote);
		fStringBuffer2.append(value);
		value.setValues(fStringBuffer2);
	}
	if (!entityScanner.skipChar((char) quote)) {
		throw new RepairableException("not found close quote");
	}
	return name;
}
 
Example #28
Source File: HTMLSAXParser.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void characters(XMLString xmlString, Augmentations augmentations)
        throws XNIException {
    super.characters(xmlString, augmentations);
    buffer.append(" ");
    buffer.append(xmlString.toString());
}
 
Example #29
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException,
		TmxEndEntityException, RepairableException {

	String systemId = null;
	String publicId = null;
	if (entityScanner.skipString("PUBLIC")) {
		if (!entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterPUBLIC");
		}
		scanPubidLiteral(fString);
		publicId = fString.toString();

		if (!entityScanner.skipSpaces() && !optionalSystemId) {
			newRepairableException("SpaceRequiredBetweenPublicAndSystem");
		}
	}

	if (publicId != null || entityScanner.skipString("SYSTEM")) {
		if (publicId == null && !entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterSYSTEM");
		}
		int quote = entityScanner.peekChar();
		if (quote != '\'' && quote != '"') {
			if (publicId != null && optionalSystemId) {
				// looks like we don't have any system id
				// simply return the public id
				identifiers[0] = null;
				identifiers[1] = publicId;
				return;
			}
			newRepairableException("QuoteRequiredInSystemID");
		}
		entityScanner.scanChar();
		XMLString ident = fString;
		if (entityScanner.scanLiteral(quote, ident) != quote) {
			fStringBuffer.clear();
			do {
				fStringBuffer.append(ident);
				int c = entityScanner.peekChar();
				if (XMLChar.isMarkup(c) || c == ']') {
					fStringBuffer.append((char) entityScanner.scanChar());
				} else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer);
				} else if (XMLChar.isInvalid(c)) {
					newRepairableException("InvalidCharInSystemID");
					entityScanner.scanChar();
				}
			} while (entityScanner.scanLiteral(quote, ident) != quote);
			fStringBuffer.append(ident);
			ident = fStringBuffer;
		}
		systemId = ident.toString();
		if (!entityScanner.skipChar((char) quote)) {
			newRepairableException("SystemIDUnterminated");
		}
	}

	// store result in array
	identifiers[0] = systemId;
	identifiers[1] = publicId;
}
 
Example #30
Source File: TmxScanner2.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
protected int scanContent() throws IOException, TmxEndEntityException, RepairableException {

		int line = entityScanner.getLineNumber();
		int column = entityScanner.getOffsetNumber();

		XMLString content = fTempString;
		int c = entityScanner.scanContent(content);
		if (c == '\r') {
			// happens when there is the character reference &#13;
			entityScanner.scanChar();
			stringBuffer.clear();
			stringBuffer.append(content);
			stringBuffer.append((char) c);
			content = stringBuffer;
			c = -1;
		}

		// String str = new String(content.ch, content.offset, content.length);
		if (c == ']' && fTempString.length == 0) {
			stringBuffer.clear();
			stringBuffer.append((char) entityScanner.scanChar());
			// remember where we are in case we get an endEntity before we
			// could flush the buffer out - this happens when we're parsing an
			// entity which ends with a ]
			// fInScanContent = true;
			//
			// We work on a single character basis to handle cases such as:
			// ']]]>' which we might otherwise miss.
			//
			if (entityScanner.skipChar(']')) {
				stringBuffer.append(']');
				while (entityScanner.skipChar(']')) {
					stringBuffer.append(']');
				}
				if (entityScanner.skipChar('>')) {
					// TODO reportFatalError("CDEndInContent", null);
				}
			}
			// TODO fInScanContent = false;
			c = -1;
		}

		try {
			cwriter.write(content);
		} catch (RepairableException e) {
			e.setColumn(column);
			e.setRow(line);
			throw e;
		}

		return c;
	}