當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentHandler.startElement方法代碼示例

本文整理匯總了Java中org.xml.sax.ContentHandler.startElement方法的典型用法代碼示例。如果您正苦於以下問題:Java ContentHandler.startElement方法的具體用法?Java ContentHandler.startElement怎麽用?Java ContentHandler.startElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.xml.sax.ContentHandler的用法示例。


在下文中一共展示了ContentHandler.startElement方法的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");
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:26,代碼來源:AbstractMessageImpl.java

示例2: 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;
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:18,代碼來源:TagValuesQuery.java

示例3: 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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:ProblemActionHeader.java

示例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())
	{
	CountDataPointsForMetricData rec = rs.getRecord();
	ch.startElement("", tagName, tagName, rec);
	ch.endElement("", tagName, tagName);
	}
	
rs.close();
m_serializable = prevSerializeState;
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:18,代碼來源:CountDataPointsForMetricQuery.java

示例5: writeTo

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
public void writeTo(ContentHandler h, ErrorHandler errorHandler) throws SAXException {
    String nsUri = name.getNamespaceURI();
    String ln = name.getLocalPart();

    h.startPrefixMapping("",nsUri);
    if(mustUnderstand) {
        AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute(soapVersion.nsUri,MUST_UNDERSTAND,"S:"+MUST_UNDERSTAND,"CDATA", getMustUnderstandLiteral(soapVersion));
        h.startElement(nsUri,ln,ln,attributes);
    } else {
        h.startElement(nsUri,ln,ln,EMPTY_ATTS);
    }
    h.characters(value.toCharArray(),0,value.length());
    h.endElement(nsUri,ln,ln);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:StringHeader.java

示例6: 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");
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:34,代碼來源:SAAJMessage.java

示例7: startForking

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
/**
 * Starts the event forking.
 */
public void startForking(String uri, String localName, String qName, Attributes atts, ContentHandler side) throws SAXException {
    if(this.side!=null)     throw new IllegalStateException();  // can't fork to two handlers

    this.side = side;
    depth = 1;
    side.setDocumentLocator(loc);
    side.startDocument();
    for( int i=0; i<namespaces.size(); i+=2 )
        side.startPrefixMapping(namespaces.get(i),namespaces.get(i+1));
    side.startElement(uri,localName,qName,atts);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:15,代碼來源:ForkingFilter.java

示例8: 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);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:16,代碼來源:FSEditLogOp.java

示例9: 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");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:FSEditLogOp.java

示例10: 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");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:12,代碼來源:FSEditLogOp.java

示例11: 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");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:14,代碼來源:FSEditLogOp.java

示例12: permissionStatusToXml

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
public static void permissionStatusToXml(ContentHandler contentHandler,
    PermissionStatus perm) throws SAXException {
  contentHandler.startElement("", "", "PERMISSION_STATUS", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "USERNAME", perm.getUserName());
  XMLUtils.addSaxString(contentHandler, "GROUPNAME", perm.getGroupName());
  fsPermissionToXml(contentHandler, perm.getPermission());
  contentHandler.endElement("", "", "PERMISSION_STATUS");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:9,代碼來源:FSEditLogOp.java

示例13: writeTo

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
public void writeTo(ContentHandler h, ErrorHandler errorHandler) throws SAXException {
    String nsUri = av.nsUri;
    String ln = av.faultDetailTag.getLocalPart();

    h.startPrefixMapping("",nsUri);
    h.startElement(nsUri,ln,ln,EMPTY_ATTS);
    h.startElement(nsUri,wrapper,wrapper,EMPTY_ATTS);
    h.characters(problemValue.toCharArray(),0,problemValue.length());
    h.endElement(nsUri,wrapper,wrapper);
    h.endElement(nsUri,ln,ln);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:FaultDetailHeader.java

示例14: writeStart

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
/**
 * Writes the start element event.
 */
public void writeStart(ContentHandler contentHandler) throws SAXException {
    for( int i=0; i<ns.length; i+=2 )
        contentHandler.startPrefixMapping(fixNull(ns[i]),fixNull(ns[i+1]));
    contentHandler.startElement(fixNull(nsUri), localName ,getQName(), atts);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:TagInfoset.java

示例15: startElement

import org.xml.sax.ContentHandler; //導入方法依賴的package包/類
/**
 * Start new element on <code>contentHandler</code> with given <code>prefix</code>,
 * <code>localName</code> and <code>attributes</code>.
 * 
 * @param contentHandler to start element on.
 * @param prefix of element
 * @param localName of element
 * @param attributes of element
 * @throws SAXException if {@link ContentHandler#startElement(String, String, String, Attributes)}
 *         throws {@link SAXException}.
 * @since GemFire 8.1
 */
static public void startElement(final ContentHandler contentHandler, final String prefix,
    final String localName, final AttributesImpl attributes) throws SAXException {
  contentHandler.startElement(XMLConstants.NULL_NS_URI, localName, prefix + ":" + localName,
      attributes);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:18,代碼來源:XmlGeneratorUtils.java


注:本文中的org.xml.sax.ContentHandler.startElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。