本文整理汇总了Java中javax.xml.stream.events.XMLEvent.DTD属性的典型用法代码示例。如果您正苦于以下问题:Java XMLEvent.DTD属性的具体用法?Java XMLEvent.DTD怎么用?Java XMLEvent.DTD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.xml.stream.events.XMLEvent
的用法示例。
在下文中一共展示了XMLEvent.DTD属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
public int next() throws IOException, XNIException{
// throw new XNIException("DTD Parsing is currently not supported");
if(DEBUG_NEXT){
System.out.println("Now in DTD Driver");
}
dispatch(true);
if(DEBUG_NEXT){
System.out.println("After calling dispatch(true) -- At this point whole DTD is read.");
}
//xxx: remove this hack and align this with reusing DTD components
//currently this routine will only be executed from Stax
if(fPropertyManager != null){
dtdGrammarUtil = new DTDGrammarUtil(((XMLDTDScannerImpl)fDTDScanner).getGrammar(),fSymbolTable, fNamespaceContext);
}
return XMLEvent.DTD ;
}
示例2: handleEvent
private void handleEvent(XMLStreamReader xmlr, int eventType) {
switch (eventType) {
case XMLEvent.START_ELEMENT:
handleStartElement(xmlr);
break;
case XMLEvent.END_ELEMENT:
handleEndElement(xmlr);
break;
case XMLEvent.CHARACTERS:
handleCharacters(xmlr);
break;
case XMLEvent.COMMENT:
handleComment(xmlr);
break;
case XMLEvent.ENTITY_REFERENCE:
break;
case XMLEvent.ATTRIBUTE:
break;
case XMLEvent.DTD:
break;
case XMLEvent.CDATA:
break;
default:
break;
}
}
示例3: 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);
}
示例4: hasText
/** Return true if the current event has text, false otherwise
* The following events have text:
* CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
*/
public boolean hasText() {
if(DEBUG) pr("XMLReaderImpl#EVENT TYPE = " + fEventType ) ;
if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CDATA) {
return fScanner.getCharacterData().length > 0 ? true : false;
} else if(fEventType == XMLEvent.ENTITY_REFERENCE) {
String name = fScanner.getEntityName();
if(name != null){
if(fScanner.foundBuiltInRefs)
return true;
XMLEntityStorage entityStore = fEntityManager.getEntityStore();
Entity en = entityStore.getEntity(name);
if(en == null)
return false;
if(en.isExternal()){
return ((Entity.ExternalEntity)en).entityLocation.getExpandedSystemId() != null ? true : false;
} else{
return ((Entity.InternalEntity)en).text != null ? true : false ;
}
}else
return false;
} else {
if(fEventType == XMLEvent.DTD)
return fScanner.fSeenDoctypeDecl;
}
return false;
}
示例5: next
public int next() throws IOException, XNIException{
dispatch(true);
//xxx: remove this hack and align this with reusing DTD components
//currently this routine will only be executed from Stax
if(fPropertyManager != null){
dtdGrammarUtil = new DTDGrammarUtil(((XMLDTDScannerImpl)fDTDScanner).getGrammar(),fSymbolTable, fNamespaceContext);
}
return XMLEvent.DTD ;
}
示例6: 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);
}
示例7: hasText
/**
* Return true if the current event has text, false otherwise The following
* events have text: CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
*/
public boolean hasText() {
if (DEBUG) {
pr("XMLReaderImpl#EVENT TYPE = " + fEventType);
}
if (fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
|| fEventType == XMLEvent.CDATA) {
return fScanner.getCharacterData().length > 0;
} else if (fEventType == XMLEvent.ENTITY_REFERENCE) {
String name = fScanner.getEntityName();
if (name != null) {
if (fScanner.foundBuiltInRefs) {
return true;
}
XMLEntityStorage entityStore = fEntityManager.getEntityStore();
Entity en = entityStore.getEntity(name);
if (en == null) {
return false;
}
if (en.isExternal()) {
return ((Entity.ExternalEntity) en).entityLocation.getExpandedSystemId() != null;
} else {
return ((Entity.InternalEntity) en).text != null;
}
} else {
return false;
}
} else if (fEventType == XMLEvent.DTD) {
return fScanner.fSeenDoctypeDecl;
}
return false;
}
示例8: 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() " ) ;
}
}
示例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() ");
}
}