本文整理汇总了Java中com.sun.org.apache.xerces.internal.xni.XMLString类的典型用法代码示例。如果您正苦于以下问题:Java XMLString类的具体用法?Java XMLString怎么用?Java XMLString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLString类属于com.sun.org.apache.xerces.internal.xni包,在下文中一共展示了XMLString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processingInstruction
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
@Override
public void processingInstruction(
String target,
XMLString data,
Augmentations augs)
throws XNIException {
if (!fInDTD) {
if (fDocumentHandler != null
&& getState() == STATE_NORMAL_PROCESSING) {
// we need to change the depth like this so that modifyAugmentations() works
fDepth++;
augs = modifyAugmentations(augs);
fDocumentHandler.processingInstruction(target, data, augs);
fDepth--;
}
}
else if (fDTDHandler != null) {
fDTDHandler.processingInstruction(target, data, augs);
}
}
示例2: characters
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
@Override
public void characters(XMLString text, Augmentations augs)
throws XNIException {
if (getState() == STATE_NORMAL_PROCESSING) {
if (fResultDepth == 0) {
checkWhitespace(text);
}
else if (fDocumentHandler != null) {
// we need to change the depth like this so that modifyAugmentations() works
fDepth++;
augs = modifyAugmentations(augs);
fDocumentHandler.characters(text, augs);
fDepth--;
}
}
}
示例3: internalEntityDecl
import com.sun.org.apache.xerces.internal.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);
}
}
示例4: init
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
private void init() {
// initialize scanner
fEntityScanner = null;
// initialize vars
fEntityDepth = 0;
fReportEntity = true;
fResourceIdentifier.clear();
if(!fAttributeCacheInitDone){
for(int i = 0; i < initialCacheCount; i++){
attributeValueCache.add(new XMLString());
stringBufferCache.add(new XMLStringBuffer());
}
fAttributeCacheInitDone = true;
}
fStringBufferIndex = 0;
fAttributeCacheUsedCount = 0;
}
示例5: comment
import com.sun.org.apache.xerces.internal.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);
}
}
示例6: processingInstruction
import com.sun.org.apache.xerces.internal.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);
}
}
示例7: handleCharacters
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
XMLString handleCharacters(XMLString text) {
if (fSkipValidationDepth >= 0)
return text;
fSawText = fSawText || text.length > 0;
// Note: data in EntityRef and CDATA is normalized as well
// if whitespace == -1 skip normalization, because it is a complexType
// or a union type.
if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
// normalize data
normalizeWhitespace(text, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
text = fNormalizedStr;
}
if (fAppendBuffer)
fBuffer.append(text.ch, text.offset, text.length);
// When it's a complex type with element-only content, we need to
// find out whether the content contains any non-whitespace character.
fSawOnlyWhitespaceInElementContent = false;
if (fCurrentType != null
&& fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
// data outside of element content
for (int i = text.offset; i < text.offset + text.length; i++) {
if (!XMLChar.isSpace(text.ch[i])) {
fSawCharacters = true;
break;
}
fSawOnlyWhitespaceInElementContent = !fSawCharacters;
}
}
}
return text;
}
示例8: characters
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
/**
* Character content.
*
* @param text The content.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/
public void characters(XMLString text, Augmentations augs) throws XNIException {
// if type is union (XML Schema) it is possible that we receive
// character call with empty data
if (text.length == 0) {
return;
}
try {
// SAX1
if (fDocumentHandler != null) {
// REVISIT: should we support schema-normalized-value for SAX1 events
//
fDocumentHandler.characters(text.ch, text.offset, text.length);
}
// SAX2
if (fContentHandler != null) {
fContentHandler.characters(text.ch, text.offset, text.length);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例9: getString
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
/** this function gets an XMLString (which is used to store the attribute value) from the special pool
* maintained for attributes.
* fAttributeCacheUsedCount tracks the number of attributes that has been consumed from the pool.
* if all the attributes has been consumed, it adds a new XMLString inthe pool and returns the same
* XMLString.
*
* @return XMLString XMLString used to store an attribute value.
*/
protected XMLString getString(){
if(fAttributeCacheUsedCount < initialCacheCount || fAttributeCacheUsedCount < attributeValueCache.size()){
return (XMLString)attributeValueCache.get(fAttributeCacheUsedCount++);
} else{
XMLString str = new XMLString();
fAttributeCacheUsedCount++;
attributeValueCache.add(str);
return str;
}
}
示例10: normalizeDefaultAttrValue
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
/**
* Normalize the attribute value of a non CDATA default attribute
* collapsing sequences of space characters (x20)
*
* @param value The value to normalize
* @return Whether the value was changed or not.
*/
private boolean normalizeDefaultAttrValue(XMLString value) {
boolean skipSpace = true; // skip leading spaces
int current = value.offset;
int end = value.offset + value.length;
for (int i = value.offset; i < end; i++) {
if (value.ch[i] == ' ') {
if (!skipSpace) {
// take the first whitespace as a space and skip the others
value.ch[current++] = ' ';
skipSpace = true;
}
else {
// just skip it.
}
}
else {
// simply shift non space chars if needed
if (current != i) {
value.ch[current] = value.ch[i];
}
current++;
skipSpace = false;
}
}
if (current != end) {
if (skipSpace) {
// if we finished on a space trim it
current--;
}
// set the new value length
value.length = current - value.offset;
return true;
}
return false;
}
示例11: comment
import com.sun.org.apache.xerces.internal.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 {
try {
// SAX2 extension
if (fLexicalHandler != null) {
fLexicalHandler.comment(text.ch, 0, text.length);
}
}
catch (SAXException e) {
throw new XNIException(e);
}
}
示例12: attributeDecl
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
public void attributeDecl(String elementName, String attributeName,
String type, String[] enumeration, String defaultType,
XMLString defaultValue, XMLString nonNormalizedDefaultValue,
Augmentations augmentations) throws XNIException {
if (fDTDHandler != null) {
fDTDHandler.attributeDecl(elementName, attributeName,
type, enumeration, defaultType,
defaultValue, nonNormalizedDefaultValue,
augmentations);
}
}
示例13: normalizeWhitespace
import com.sun.org.apache.xerces.internal.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];
if (XMLChar.isSpace(c)) {
value.ch[i] = ' ';
}
}
}
示例14: characters
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
public void characters(XMLString text, Augmentations augs) throws XNIException {
try {
fContentHandler.characters(text.ch,text.offset,text.length);
} catch (SAXException e) {
throw new XNIException(e);
}
}
示例15: characters
import com.sun.org.apache.xerces.internal.xni.XMLString; //导入依赖的package包/类
public void characters( char[] buf, int offset, int len ) throws SAXException {
try {
fCore.characters(new XMLString(buf,offset,len),null);
} catch( WrappedSAXException e ) {
throw e.exception;
}
}