本文整理汇总了Java中org.apache.xerces.xni.XMLString类的典型用法代码示例。如果您正苦于以下问题:Java XMLString类的具体用法?Java XMLString怎么用?Java XMLString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLString类属于org.apache.xerces.xni包,在下文中一共展示了XMLString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ignorableWhitespace
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/**
* Ignorable whitespace. For this method to be called, the document
* source must have some way of determining that the text containing
* only whitespace characters should be considered ignorable. For
* example, the validator can determine if a length of whitespace
* characters in the document are ignorable based on the element
* content model.
*
* @param text The ignorable whitespace.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
try {
// SAX1
if (fDocumentHandler != null) {
fDocumentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
// SAX2
if (fContentHandler != null) {
fContentHandler.ignorableWhitespace(text.ch, text.offset, text.length);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例2: isUnchangedByNormalization
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
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;
}
示例3: characters
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
public void characters(XMLString text, Augmentations augs)
throws XNIException {
if (!fIgnoreChars) {
try {
if (!fInCDATA) {
fStreamWriter.writeCharacters(text.ch, text.offset, text.length);
}
else {
fStreamWriter.writeCData(text.toString());
}
}
catch (XMLStreamException e) {
throw new XNIException(e);
}
}
}
示例4: characters
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
public void characters(XMLString text, Augmentations augs)
throws XNIException {
if (fContentHandler != null) {
// if the type is union it is possible that we receive
// a character call with empty data
if (text.length == 0) {
return;
}
try {
fContentHandler.characters(text.ch, text.offset, text.length);
}
catch (SAXException e) {
throw new XNIException(e);
}
}
}
示例5: processingInstruction
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/** Processing instruction. */
public void processingInstruction(String target, XMLString data, Augmentations augs)
throws XNIException {
printIndent();
fOut.print("processingInstruction(");
fOut.print("target=");
printQuotedString(target);
fOut.print(',');
fOut.print("data=");
printQuotedString(data.ch, data.offset, data.length);
if (augs != null) {
fOut.print(',');
printAugmentations(augs);
}
fOut.println(')');
fOut.flush();
}
示例6: normalizeWhitespace
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/**
* Normalize whitespace in an XMLString converting all whitespace
* characters to space characters.
*/
protected 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] = ' ';
}
}
}
示例7: internalEntityDecl
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/** Internal entity declaration. */
public void internalEntityDecl(String name, XMLString text,
XMLString nonNormalizedText,
Augmentations augs)
throws XNIException {
printIndent();
fOut.print("internalEntityDecl(");
fOut.print("name=");
printQuotedString(name);
fOut.print(',');
fOut.print("text=");
printQuotedString(text.ch, text.offset, text.length);
fOut.print(',');
fOut.print("nonNormalizedText=");
printQuotedString(nonNormalizedText.ch, nonNormalizedText.offset,
nonNormalizedText.length);
if (augs != null) {
fOut.print(',');
printAugmentations(augs);
}
fOut.println(')');
fOut.flush();
}
示例8: write
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
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, ""));
}
}
示例9: internalEntityDecl
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/**
* An internal entity declaration.
*
* @param name The name of the entity. Parameter entity names start with
* '%', whereas the name of a general entity is just the
* entity name.
* @param text The value of the entity.
* @param nonNormalizedText The non-normalized value of the entity. This
* value contains the same sequence of characters that was in
* the internal entity declaration, without any entity
* references expanded.
* @param augs Additional information that may include infoset
* augmentations.
* @throws XNIException Thrown by handler to signal an error.
*/
public void internalEntityDecl(String name, XMLString text,
XMLString nonNormalizedText,
Augmentations augs) throws XNIException {
int entityIndex = getEntityDeclIndex(name);
if( entityIndex == -1){
entityIndex = createEntityDecl();
boolean isPE = name.startsWith("%");
boolean inExternal = (fReadingExternalDTD || fPEDepth > 0);
XMLEntityDecl entityDecl = new XMLEntityDecl();
entityDecl.setValues(name,null,null, null, null,
text.toString(), isPE, inExternal);
setEntityDecl(entityIndex, entityDecl);
}
}
示例10: comment
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/**
* A comment.
*
* @param text The text in the comment.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by application to signal an error.
*/
public void comment(XMLString text, Augmentations augs) throws XNIException {
// fixes E15.1
if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) {
fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl);
if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"MSG_CONTENT_INVALID_SPECIFIED",
new Object[]{ fCurrentElement.rawname,
"EMPTY",
"comment"},
XMLErrorReporter.SEVERITY_ERROR);
}
}
// call handlers
if (fDocumentHandler != null) {
fDocumentHandler.comment(text, augs);
}
}
示例11: processingInstruction
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/**
* A processing instruction. Processing instructions consist of a
* target name and, optionally, text data. The data is only meaningful
* to the application.
* <p>
* Typically, a processing instruction's data will contain a series
* of pseudo-attributes. These pseudo-attributes follow the form of
* element attributes but are <strong>not</strong> parsed or presented
* to the application as anything other than text. The application is
* responsible for parsing the data.
*
* @param target The target.
* @param data The data or null if none specified.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void processingInstruction(String target, XMLString data, Augmentations augs)
throws XNIException {
// fixes E15.1
if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) {
fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl);
if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"MSG_CONTENT_INVALID_SPECIFIED",
new Object[]{ fCurrentElement.rawname,
"EMPTY",
"processing instruction"},
XMLErrorReporter.SEVERITY_ERROR);
}
}
// call handlers
if (fDocumentHandler != null) {
fDocumentHandler.processingInstruction(target, data, augs);
}
}
示例12: comment
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/** Comment. */
public void comment(XMLString text, Augmentations augs) throws XNIException {
fSeenAnything = true;
consumeEarlyTextIfNeeded();
if (fDocumentHandler != null) {
fDocumentHandler.comment(text, augs);
}
}
示例13: processingInstruction
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
/** Processing instruction. */
public void processingInstruction(String target, XMLString data,
Augmentations augs) throws XNIException {
fSeenAnything = true;
consumeEarlyTextIfNeeded();
if (fDocumentHandler != null) {
fDocumentHandler.processingInstruction(target, data, augs);
}
}
示例14: ignorableWhitespace
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
@Override
public void ignorableWhitespace(XMLString arg0, Augmentations arg1)
throws XNIException {
if(DEBUG_UNUSED) {
Out.println("ignorableWhitespace: " + arg0);
}
}
示例15: characters
import org.apache.xerces.xni.XMLString; //导入依赖的package包/类
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 );
}
}