javax.xml.stream.events.DTD.getDocumentTypeDeclaration()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中javax.xml.stream.events.DTD.getDocumentTypeDeclaration()方法的一些代码示例,展示了DTD.getDocumentTypeDeclaration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DTD.getDocumentTypeDeclaration()方法的具体详情如下:
包路径:javax.xml.stream.events.DTD
类名称:DTD
方法名:getDocumentTypeDeclaration

DTD.getDocumentTypeDeclaration介绍

[英]Returns the entire Document Type Declaration as a string, including the internal DTD subset. This may be null if there is not an internal subset. If it is not null it must return the entire Document Type Declaration which matches the doctypedecl production in the XML 1.0 specification
[中]以字符串形式返回整个文档类型声明,包括内部DTD子集。如果没有内部子集,则该值可能为空。如果不为null,则必须返回与XML 1.0规范中的doctypedecl产品相匹配的整个文档类型声明

代码示例

代码示例来源:origin: net.java.dev.stax-utils/stax-utils

/**
 * Compares two {@link DTD}s. This method will return <code>true</code>
 * only if their declarations are identical.
 * 
 * @param a The first event.
 * @param b The second event.
 * @return <code>true</code> if the events match, <code>false</code> otherwise.
 */
public static boolean eventsMatch(DTD a, DTD b) {
  if (a == b) {
    return true;
  } else if (a == null || a == null) {
    return false;
  } else {
    // TODO determine the best way to compare DTD events
    return a.getDocumentTypeDeclaration().equals(
        b.getDocumentTypeDeclaration());
  }
}

代码示例来源:origin: org.jdom/jdom

final DocType dtype = DTDParser.parse(((javax.xml.stream.events.DTD)event).getDocumentTypeDeclaration(), factory);
  document.setDocType(dtype);
} else if (event.isStartElement()) {

代码示例来源:origin: net.java.dev.stax-utils/stax-utils

/**
 * Writes a {@link DTD} to the provided stream.
 * 
 * @param dtd The {@link DTD} to write.
 * @param writer The destination stream.
 * @throws XMLStreamException If an error occurs writing to the stream.
 */
public static final void writeDTD(DTD dtd, XMLStreamWriter writer)
    throws XMLStreamException {
  writer.writeDTD(dtd.getDocumentTypeDeclaration());
}

代码示例来源:origin: stax/stax

public void addDTD(DTD dtd)
 throws XMLStreamException
{
 writer.writeDTD(dtd.getDocumentTypeDeclaration());
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-ts

private void procDTD(XMLEvent event) {
  DTD dtd = (DTD) event;
  skel.append(dtd.getDocumentTypeDeclaration().replace("\n", lineBreak));
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

public void doctypeDecl(DTD event) throws XMLStreamException {
  fStreamWriter.writeDTD(event.getDocumentTypeDeclaration());
}

代码示例来源:origin: net.java.dev.stax-utils/stax-utils

/** Copy constructor. */
public DTDEvent(DTD that) {
  super(that);
  this.declaration = that.getDocumentTypeDeclaration();
  this.entities = that.getEntities();
  this.notations = that.getNotations();
}

代码示例来源:origin: Nextdoor/bender

public boolean equals(Object o)
{
  if (o == this) return true;
  if (o == null) return false;
  if (!(o instanceof DTD)) return false;
  DTD other = (DTD) o;
  /* Hmmh. Comparison for this event get very
   * tricky, very fast, if one tries to do it correctly
   * (partly due to Stax2 incompleteness, but not just
   * because of that)... let's actually try to minimize
   * work here
   */
  return stringsWithNullsEqual(getDocumentTypeDeclaration(),
                 other.getDocumentTypeDeclaration());
}

代码示例来源:origin: org.apache.santuario/xmlsec

@Override
public int getTextLength() {
  XMLSecEvent xmlSecEvent = getCurrentEvent();
  switch (xmlSecEvent.getEventType()) {
    case ENTITY_REFERENCE:
      return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().length();
    case DTD:
      return ((DTD) xmlSecEvent).getDocumentTypeDeclaration().length();
    case COMMENT:
      return ((Comment) xmlSecEvent).getText().length();
    case CDATA:
    case SPACE:
    case CHARACTERS:
      return xmlSecEvent.asCharacters().getData().length();
    default:
      throw new IllegalStateException("Current state not TEXT");
  }
}

代码示例来源:origin: com.caucho/resin

public boolean equals(Object o) 
 {
  if (! (o instanceof DTD))
   return false;
  if (o == null)
   return false;
  if (this == o)
   return true;

  DTD dtd = (DTD) o;

  return 
   getDocumentTypeDeclaration().equals(dtd.getDocumentTypeDeclaration()) &&
   getEntities().equals(dtd.getEntities()) &&
   getNotations().equals(dtd.getNotations()) &&
   getProcessedDTD().equals(dtd.getProcessedDTD());
 }
}

代码示例来源:origin: org.apache.santuario/xmlsec

@Override
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
  XMLSecEvent xmlSecEvent = getCurrentEvent();
  switch (xmlSecEvent.getEventType()) {
    case ENTITY_REFERENCE:
      ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().getChars(sourceStart, sourceStart + length, target, targetStart);
      return length;
    case DTD:
      ((DTD) xmlSecEvent).getDocumentTypeDeclaration().getChars(sourceStart, sourceStart + length, target, targetStart);
      return length;
    case COMMENT:
      ((Comment) xmlSecEvent).getText().getChars(sourceStart, sourceStart + length, target, targetStart);
      return length;
    case CDATA:
    case SPACE:
    case CHARACTERS:
      xmlSecEvent.asCharacters().getData().getChars(sourceStart, sourceStart + length, target, targetStart);
      return length;
    default:
      throw new IllegalStateException("Current state not TEXT");
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

@Override
public char[] getTextCharacters() {
  XMLSecEvent xmlSecEvent = getCurrentEvent();
  switch (xmlSecEvent.getEventType()) {
    case ENTITY_REFERENCE:
      return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText().toCharArray();
    case DTD:
      return ((DTD) xmlSecEvent).getDocumentTypeDeclaration().toCharArray();
    case COMMENT:
      return ((Comment) xmlSecEvent).getText().toCharArray();
    case CDATA:
    case SPACE:
    case CHARACTERS:
      return xmlSecEvent.asCharacters().getText();
    default:
      throw new IllegalStateException("Current state not TEXT");
  }
}

代码示例来源:origin: wso2/wso2-synapse

break;
case XMLStreamConstants.DTD:
  delegate.writeDTD(((DTD) event).getDocumentTypeDeclaration());
  break;
case XMLStreamConstants.ENTITY_REFERENCE:

代码示例来源:origin: org.wso2.staxon/staxon

break;
case XMLStreamConstants.DTD:
  delegate.writeDTD(((DTD) event).getDocumentTypeDeclaration());
  break;
case XMLStreamConstants.ENTITY_REFERENCE:

代码示例来源:origin: org.apache.santuario/xmlsec

@Override
public String getText() {
  XMLSecEvent xmlSecEvent = getCurrentEvent();
  switch (xmlSecEvent.getEventType()) {
    case ENTITY_REFERENCE:
      return ((EntityReference) xmlSecEvent).getDeclaration().getReplacementText();
    case DTD:
      return ((DTD) xmlSecEvent).getDocumentTypeDeclaration();
    case COMMENT:
      return ((Comment) xmlSecEvent).getText();
    case CDATA:
    case SPACE:
    case CHARACTERS:
      return xmlSecEvent.asCharacters().getData();
    default:
      throw new IllegalStateException("Current state not TEXT");
  }
}

代码示例来源:origin: apache/cxf

break;
case XMLStreamConstants.DTD:
  writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
  break;
case XMLStreamConstants.PROCESSING_INSTRUCTION:

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

break;
case XMLEvent.DTD:
  writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
  break;
case XMLEvent.PROCESSING_INSTRUCTION:

代码示例来源:origin: org.apache.cxf/cxf-api

break;
case XMLEvent.DTD:
  writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
  break;
case XMLEvent.PROCESSING_INSTRUCTION:

代码示例来源:origin: org.apache.cxf/cxf-core

break;
case XMLStreamConstants.DTD:
  writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
  break;
case XMLStreamConstants.PROCESSING_INSTRUCTION:

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

break;
case XMLEvent.DTD:
  writer.writeDTD(((DTD)event).getDocumentTypeDeclaration());
  break;
case XMLEvent.PROCESSING_INSTRUCTION:

相关文章