本文整理匯總了Java中javax.xml.stream.events.XMLEvent.SPACE屬性的典型用法代碼示例。如果您正苦於以下問題:Java XMLEvent.SPACE屬性的具體用法?Java XMLEvent.SPACE怎麽用?Java XMLEvent.SPACE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.xml.stream.events.XMLEvent
的用法示例。
在下文中一共展示了XMLEvent.SPACE屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTextCharacters
/**
* @return
*/
public char[] getTextCharacters() {
if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
return fScanner.getCharacterData().ch;
} else{
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextCharacters() " ) ;
}
}
示例2: getTextLength
/**
* @return
*/
public int getTextLength() {
if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
return fScanner.getCharacterData().length;
} else{
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextLength() " ) ;
}
}
示例3: getTextStart
/**
* @return
*/
public int getTextStart() {
if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
return fScanner.getCharacterData().offset;
} else{
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextStart() " ) ;
}
}
示例4: getEventTypeString
final static String getEventTypeString(int eventType) {
switch (eventType){
case XMLEvent.START_ELEMENT:
return "START_ELEMENT";
case XMLEvent.END_ELEMENT:
return "END_ELEMENT";
case XMLEvent.PROCESSING_INSTRUCTION:
return "PROCESSING_INSTRUCTION";
case XMLEvent.CHARACTERS:
return "CHARACTERS";
case XMLEvent.COMMENT:
return "COMMENT";
case XMLEvent.START_DOCUMENT:
return "START_DOCUMENT";
case XMLEvent.END_DOCUMENT:
return "END_DOCUMENT";
case XMLEvent.ENTITY_REFERENCE:
return "ENTITY_REFERENCE";
case XMLEvent.ATTRIBUTE:
return "ATTRIBUTE";
case XMLEvent.DTD:
return "DTD";
case XMLEvent.CDATA:
return "CDATA";
case XMLEvent.SPACE:
return "SPACE";
}
return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
示例5: getTextCharacters
/**
* @return
*/
public char[] getTextCharacters() {
if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
return fScanner.getCharacterData().ch;
} else {
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextCharacters() ");
}
}
示例6: getTextLength
/**
* @return
*/
public int getTextLength() {
if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
return fScanner.getCharacterData().length;
} else {
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextLength() ");
}
}
示例7: getTextStart
/**
* @return
*/
public int getTextStart() {
if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
return fScanner.getCharacterData().offset;
} else {
throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
+ getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+ " , " + getEventTypeString(XMLEvent.SPACE) + " valid for getTextStart() ");
}
}
示例8: getEventTypeString
final static String getEventTypeString(int eventType) {
switch (eventType) {
case XMLEvent.START_ELEMENT:
return "START_ELEMENT";
case XMLEvent.END_ELEMENT:
return "END_ELEMENT";
case XMLEvent.PROCESSING_INSTRUCTION:
return "PROCESSING_INSTRUCTION";
case XMLEvent.CHARACTERS:
return "CHARACTERS";
case XMLEvent.COMMENT:
return "COMMENT";
case XMLEvent.START_DOCUMENT:
return "START_DOCUMENT";
case XMLEvent.END_DOCUMENT:
return "END_DOCUMENT";
case XMLEvent.ENTITY_REFERENCE:
return "ENTITY_REFERENCE";
case XMLEvent.ATTRIBUTE:
return "ATTRIBUTE";
case XMLEvent.DTD:
return "DTD";
case XMLEvent.CDATA:
return "CDATA";
case XMLEvent.SPACE:
return "SPACE";
}
return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
示例9: getText
/** Returns the current value of the parse event as a string,
* this returns the string value of a CHARACTERS event,
* returns the value of a COMMENT, the replacement value
* for an ENTITY_REFERENCE,
* or the String value of the DTD
* @return the current text or null
* @throws java.lang.IllegalStateException if this state is not
* a valid text state.
*/
public String getText() {
if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
//this requires creation of new string
//fEventType == XMLEvent.ENTITY_REFERENCE
return fScanner.getCharacterData().toString() ;
} else if(fEventType == XMLEvent.ENTITY_REFERENCE){
String name = fScanner.getEntityName();
if(name != null){
if(fScanner.foundBuiltInRefs)
return fScanner.getCharacterData().toString();
XMLEntityStorage entityStore = fEntityManager.getEntityStore();
Entity en = entityStore.getEntity(name);
if(en == null)
return null;
if(en.isExternal())
return ((Entity.ExternalEntity)en).entityLocation.getExpandedSystemId();
else
return ((Entity.InternalEntity)en).text;
}else
return null;
}
else if(fEventType == XMLEvent.DTD){
if(fDTDDecl != null){
return fDTDDecl;
}
XMLStringBuffer tmpBuffer = fScanner.getDTDDecl();
fDTDDecl = tmpBuffer.toString();
return fDTDDecl;
} else{
throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
+ " is not among the states" + getEventTypeString(XMLEvent.CHARACTERS) + ", "
+ getEventTypeString(XMLEvent.COMMENT) + ", "
+ getEventTypeString(XMLEvent.CDATA) + ", "
+ getEventTypeString(XMLEvent.SPACE) + ", "
+ getEventTypeString(XMLEvent.ENTITY_REFERENCE) + ", "
+ getEventTypeString(XMLEvent.DTD) + " valid for getText() " ) ;
}
}
示例10: getText
/**
* Returns the current value of the parse event as a string, this returns
* the string value of a CHARACTERS event, returns the value of a COMMENT,
* the replacement value for an ENTITY_REFERENCE, or the String value of the
* DTD
*
* @return the current text or null
* @throws java.lang.IllegalStateException if this state is not a valid text
* state.
*/
public String getText() {
if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE) {
//this requires creation of new string
//fEventType == XMLEvent.ENTITY_REFERENCE
return fScanner.getCharacterData().toString();
} else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
String name = fScanner.getEntityName();
if (name != null) {
if (fScanner.foundBuiltInRefs) {
return fScanner.getCharacterData().toString();
}
XMLEntityStorage entityStore = fEntityManager.getEntityStore();
Entity en = entityStore.getEntity(name);
if (en == null) {
return null;
}
if (en.isExternal()) {
return ((Entity.ExternalEntity) en).entityLocation.getExpandedSystemId();
} else {
return ((Entity.InternalEntity) en).text;
}
} else {
return null;
}
} else if (fEventType == XMLEvent.DTD) {
if (fDTDDecl != null) {
return fDTDDecl;
}
XMLStringBuffer tmpBuffer = fScanner.getDTDDecl();
fDTDDecl = tmpBuffer.toString();
return fDTDDecl;
} else {
throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
+ " is not among the states" + getEventTypeString(XMLEvent.CHARACTERS) + ", "
+ getEventTypeString(XMLEvent.COMMENT) + ", "
+ getEventTypeString(XMLEvent.CDATA) + ", "
+ getEventTypeString(XMLEvent.SPACE) + ", "
+ getEventTypeString(XMLEvent.ENTITY_REFERENCE) + ", "
+ getEventTypeString(XMLEvent.DTD) + " valid for getText() ");
}
}