本文整理汇总了Java中org.xml.sax.ContentHandler.endElement方法的典型用法代码示例。如果您正苦于以下问题:Java ContentHandler.endElement方法的具体用法?Java ContentHandler.endElement怎么用?Java ContentHandler.endElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.ContentHandler
的用法示例。
在下文中一共展示了ContentHandler.endElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeTo
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Writes the whole envelope as SAX events.
*/
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
String soapNsUri = soapVersion.nsUri;
contentHandler.setDocumentLocator(NULL_LOCATOR);
contentHandler.startDocument();
contentHandler.startPrefixMapping("S",soapNsUri);
contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
if(hasHeaders()) {
contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(contentHandler,errorHandler);
}
contentHandler.endElement(soapNsUri,"Header","S:Header");
}
// write the body
contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
writePayloadTo(contentHandler,errorHandler, true);
contentHandler.endElement(soapNsUri,"Body","S:Body");
contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
示例2: outputTableMetaData
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Serialise the meta data for a table.
*
* @param table The meta data to serialise.
* @param contentHandler Content handler to receive the meta data xml.
* @throws SAXException Propagates from SAX API calls.
*/
private void outputTableMetaData(Table table, ContentHandler contentHandler) throws SAXException {
AttributesImpl tableAttributes = new AttributesImpl();
tableAttributes.addAttribute(XmlDataSetNode.URI, XmlDataSetNode.NAME_ATTRIBUTE, XmlDataSetNode.NAME_ATTRIBUTE,
XmlDataSetNode.STRING_TYPE, table.getName());
contentHandler.startElement(XmlDataSetNode.URI, XmlDataSetNode.METADATA_NODE, XmlDataSetNode.METADATA_NODE, tableAttributes);
for (Column column : table.columns()) {
emptyElement(contentHandler, XmlDataSetNode.COLUMN_NODE, buildColumnAttributes(column));
}
// we need to sort the indexes by name to ensure consistency, since indexes don't have an explicit "sequence" in databases.
List<Index> indexes = new ArrayList<>(table.indexes());
Collections.sort(indexes, new Comparator<Index>() {
@Override
public int compare(Index o1, Index o2) {
return o1.getName().compareTo(o2.getName());
}
});
for (Index index : indexes) {
emptyElement(contentHandler, XmlDataSetNode.INDEX_NODE, buildIndexAttributes(index));
}
contentHandler.endElement(XmlDataSetNode.URI, XmlDataSetNode.METADATA_NODE, XmlDataSetNode.METADATA_NODE);
}
示例3: serializeQuery
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void serializeQuery(ContentHandler ch, String tagName)
throws org.xml.sax.SAXException
{
boolean prevSerializeState = m_serializable;
m_serializable = true;
ResultSet rs = runQuery();
while (rs.next())
{
CountDataPointsForMetricData rec = rs.getRecord();
ch.startElement("", tagName, tagName, rec);
ch.endElement("", tagName, tagName);
}
rs.close();
m_serializable = prevSerializeState;
}
示例4: serializeQuery
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void serializeQuery(ContentHandler ch, String tagName)
throws org.xml.sax.SAXException
{
boolean prevSerializeState = m_serializable;
m_serializable = true;
ResultSet rs = runQuery();
while (rs.next())
{
MetricIdsWithTagsData rec = rs.getRecord();
ch.startElement("", tagName, tagName, rec);
ch.endElement("", tagName, tagName);
}
rs.close();
m_serializable = prevSerializeState;
}
示例5: appendXAttrsToXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
private static void appendXAttrsToXml(ContentHandler contentHandler,
List<XAttr> xAttrs) throws SAXException {
for (XAttr xAttr: xAttrs) {
contentHandler.startElement("", "", "XATTR", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "NAMESPACE",
xAttr.getNameSpace().toString());
XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
if (xAttr.getValue() != null) {
try {
XMLUtils.addSaxString(contentHandler, "VALUE",
XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
} catch (IOException e) {
throw new SAXException(e);
}
}
contentHandler.endElement("", "", "XATTR");
}
}
示例6: serializeQuery
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void serializeQuery(ContentHandler ch, String tagName)
throws org.xml.sax.SAXException
{
boolean prevSerializeState = m_serializable;
m_serializable = true;
ResultSet rs = runQuery();
while (rs.next())
{
TagValuesData rec = rs.getRecord();
ch.startElement("", tagName, tagName, rec);
ch.endElement("", tagName, tagName);
}
rs.close();
m_serializable = prevSerializeState;
}
示例7: writeTo
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void writeTo(ContentHandler h, ErrorHandler errorHandler) throws SAXException {
String nsUri = getNamespaceURI();
String ln = getLocalPart();
h.startPrefixMapping("",nsUri);
h.startElement(nsUri,ln,ln,EMPTY_ATTS);
h.startElement(nsUri,actionLocalName,actionLocalName,EMPTY_ATTS);
h.characters(action.toCharArray(),0,action.length());
h.endElement(nsUri,actionLocalName,actionLocalName);
if (soapAction != null) {
h.startElement(nsUri,soapActionLocalName,soapActionLocalName,EMPTY_ATTS);
h.characters(soapAction.toCharArray(),0,soapAction.length());
h.endElement(nsUri,soapActionLocalName,soapActionLocalName);
}
h.endElement(nsUri,ln,ln);
}
示例8: writeTo
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException {
String soapNsUri = soapVersion.nsUri;
if (!parsedMessage) {
DOMScanner ds = new DOMScanner();
ds.setContentHandler(contentHandler);
ds.scan(sm.getSOAPPart());
} else {
contentHandler.setDocumentLocator(NULL_LOCATOR);
contentHandler.startDocument();
contentHandler.startPrefixMapping("S", soapNsUri);
startPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs));
if (hasHeaders()) {
startPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs));
MessageHeaders headers = getHeaders();
for (Header h : headers.asList()) {
h.writeTo(contentHandler, errorHandler);
}
endPrefixMapping(contentHandler, headerAttrs,"S");
contentHandler.endElement(soapNsUri, "Header", "S:Header");
}
startPrefixMapping(contentHandler, bodyAttrs,"S");
// write the body
contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs));
writePayloadTo(contentHandler, errorHandler, true);
endPrefixMapping(contentHandler, bodyAttrs,"S");
contentHandler.endElement(soapNsUri, "Body", "S:Body");
endPrefixMapping(contentHandler, envelopeAttrs,"S");
contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope");
}
}
示例9: writeEnd
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Writes the end element event.
*/
public void writeEnd(ContentHandler contentHandler) throws SAXException{
contentHandler.endElement(fixNull(nsUri),localName,getQName());
for( int i=ns.length-2; i>=0; i-=2 ) {
contentHandler.endPrefixMapping(fixNull(ns[i]));
}
}
示例10: toXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "TRG", trg);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
contentHandler.startElement("", "", "SOURCES", new AttributesImpl());
for (int i = 0; i < srcs.length; ++i) {
XMLUtils.addSaxString(contentHandler,
"SOURCE" + (i + 1), srcs[i]);
}
contentHandler.endElement("", "", "SOURCES");
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
示例11: outputToXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public void outputToXml(ContentHandler contentHandler) throws SAXException {
contentHandler.startElement("", "", "RECORD", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "OPCODE", opCode.toString());
contentHandler.startElement("", "", "DATA", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "TXID", "" + txid);
toXml(contentHandler);
contentHandler.endElement("", "", "DATA");
contentHandler.endElement("", "", "RECORD");
}
示例12: blockToXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public static void blockToXml(ContentHandler contentHandler, Block block)
throws SAXException {
contentHandler.startElement("", "", "BLOCK", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
Long.toString(block.getBlockId()));
XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
Long.toString(block.getNumBytes()));
XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.toString(block.getGenerationStamp()));
contentHandler.endElement("", "", "BLOCK");
}
示例13: delegationKeyToXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
public static void delegationKeyToXml(ContentHandler contentHandler,
DelegationKey key) throws SAXException {
contentHandler.startElement("", "", "DELEGATION_KEY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "KEY_ID",
Integer.toString(key.getKeyId()));
XMLUtils.addSaxString(contentHandler, "EXPIRY_DATE",
Long.toString(key.getExpiryDate()));
if (key.getEncodedKey() != null) {
XMLUtils.addSaxString(contentHandler, "KEY",
Hex.encodeHexString(key.getEncodedKey()));
}
contentHandler.endElement("", "", "DELEGATION_KEY");
}
示例14: appendAclEntriesToXml
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
private static void appendAclEntriesToXml(ContentHandler contentHandler,
List<AclEntry> aclEntries) throws SAXException {
for (AclEntry e : aclEntries) {
contentHandler.startElement("", "", "ENTRY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "SCOPE", e.getScope().name());
XMLUtils.addSaxString(contentHandler, "TYPE", e.getType().name());
if (e.getName() != null) {
XMLUtils.addSaxString(contentHandler, "NAME", e.getName());
}
fsActionToXml(contentHandler, e.getPermission());
contentHandler.endElement("", "", "ENTRY");
}
}
示例15: addSaxString
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Add a SAX tag with a string inside.
*
* @param contentHandler the SAX content handler
* @param tag the element tag to use
* @param val the string to put inside the tag
*/
public static void addSaxString(ContentHandler contentHandler,
String tag, String val) throws SAXException {
contentHandler.startElement("", "", tag, new AttributesImpl());
char c[] = mangleXmlString(val, false).toCharArray();
contentHandler.characters(c, 0, c.length);
contentHandler.endElement("", "", tag);
}