本文整理汇总了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() ");
}
}