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


Java XMLWriter.startDocument方法代碼示例

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


在下文中一共展示了XMLWriter.startDocument方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Dom4JXmlWriter

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
public Dom4JXmlWriter(XMLWriter paramXMLWriter, NameCoder paramNameCoder)
{
  super(paramNameCoder);
  this.writer = paramXMLWriter;
  this.elementStack = new FastStack(16);
  this.attributes = new AttributesImpl();
  try
  {
    paramXMLWriter.startDocument();
    return;
  }
  catch (SAXException localSAXException)
  {
    throw new StreamException(localSAXException);
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:17,代碼來源:Dom4JXmlWriter.java

示例2: store

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
/**
   * Store snips and users from the SnipSpace to an xml document into a stream.
   * @param out outputstream to write to
   */
  public static void store(OutputStream out, String appOid, Connection connection) {
    try {
      OutputFormat outputFormat = new OutputFormat();
      outputFormat.setEncoding("UTF-8");
      outputFormat.setNewlines(true);

      XMLWriter xmlWriter = new XMLWriter(out, outputFormat);
      xmlWriter.startDocument();
      Element root = DocumentHelper.createElement("snipspace");
      xmlWriter.writeOpen(root);

//      storeUsers(xmlWriter, connection);
      storeSnips(xmlWriter, appOid, connection);

      xmlWriter.writeClose(root);
      xmlWriter.endDocument();
      xmlWriter.flush();
      xmlWriter.close();
    } catch (Exception e) {
      System.err.println("JDBCDatabaseExport: error while writing document: " + e.getMessage());
    }
  }
 
開發者ID:thinkberg,項目名稱:snipsnap,代碼行數:27,代碼來源:JDBCDatabaseExport.java

示例3: updateImportFile

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
/**
 * Updates the passed import file into the equivalent 1.4 format.
 * 
 * @param source		the source import file
 * @param destination	the destination import file
 */
public void updateImportFile(String source, String destination)
{
	XmlPullParser reader = getReader(source);
	XMLWriter writer = getWriter(destination);
	this.shownWarning = false;
	
	try
	{
		// Start the documentation
		writer.startDocument();
		
		// Start reading the document
		int eventType = reader.getEventType();
		while (eventType != XmlPullParser.END_DOCUMENT) 
        {
            if (eventType == XmlPullParser.START_TAG) 
			{
            	ImportFileUpdater.this.outputCurrentElement(reader, writer, new OutputChildren());
			} 
			eventType = reader.next();
        }
		
		// End and close the document
		writer.endDocument();
		writer.close();
	}
	catch (Exception exception)
	{
		throw new AlfrescoRuntimeException("Unable to update import file.", exception);
	}
	
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:39,代碼來源:ImportFileUpdater.java

示例4: Dom4JXmlWriter

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
/**
 * @since 1.4
 */
public Dom4JXmlWriter(final XMLWriter writer, final NameCoder nameCoder) {
    super(nameCoder);
    this.writer = writer;
    elementStack = new FastStack<String>(16);
    attributes = new AttributesImpl();
    try {
        writer.startDocument();
    } catch (final SAXException e) {
        throw new StreamException(e);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:Dom4JXmlWriter.java

示例5: Dom4JXmlWriter

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
/**
 * @since 1.4
 */
public Dom4JXmlWriter(final XMLWriter writer, final NameCoder nameCoder) {
    super(nameCoder);
    this.writer = writer;
    elementStack = new FastStack<>(16);
    attributes = new AttributesImpl();
    try {
        writer.startDocument();
    } catch (final SAXException e) {
        throw new StreamException(e);
    }
}
 
開發者ID:x-stream,項目名稱:xstream,代碼行數:15,代碼來源:Dom4JXmlWriter.java

示例6: generateResponse

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
/**
 * Generates the XML lock discovery response body
 */
protected void generateResponse(FileInfo lockNodeInfo, String userName) throws Exception
{
    String scope;
    String lt;
    String owner;
    Date expiry;
    
    if (lockToken != null)
    {
        // In case of lock creation take the scope from request header
        scope = this.createExclusive ? WebDAV.XML_EXCLUSIVE : WebDAV.XML_SHARED;
        // Output created lock
        lt = lockToken;
    }
    else
    {
        // In case of lock refreshing take the scope from previously stored lock
        scope = this.lockInfo.getScope();
        // Output refreshed lock
        lt = this.lockInfo.getExclusiveLockToken();
    }
    owner = lockInfo.getOwner();
    expiry = lockInfo.getExpires();
    
    XMLWriter xml = createXMLWriter();

    xml.startDocument();

    String nsdec = generateNamespaceDeclarations(null);
    xml.startElement(WebDAV.DAV_NS, WebDAV.XML_PROP + nsdec, WebDAV.XML_NS_PROP + nsdec, getDAVHelper().getNullAttributes());

    // Output the lock details
    generateLockDiscoveryXML(xml, lockNodeInfo, false, scope, WebDAV.getDepthName(m_depth), lt, owner, expiry);

    // Close off the XML
    xml.endElement(WebDAV.DAV_NS, WebDAV.XML_PROP, WebDAV.XML_NS_PROP);

    // Send remaining data
    flushXML(xml);
   
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:45,代碼來源:LockMethod.java

示例7: generateResponseImpl

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
@Override
protected void generateResponseImpl() throws Exception
{
    m_response.setStatus(WebDAV.WEBDAV_SC_MULTI_STATUS);
    
    // Set the response content type
    m_response.setContentType(WebDAV.XML_CONTENT_TYPE);
    
    // Create multistatus response
    XMLWriter xml = createXMLWriter();

    xml.startDocument();

    String nsdec = generateNamespaceDeclarations(m_namespaces);
    xml.startElement(
            WebDAV.DAV_NS,
            WebDAV.XML_MULTI_STATUS + nsdec,
            WebDAV.XML_NS_MULTI_STATUS + nsdec,
            getDAVHelper().getNullAttributes());
    
    // Output the response block for the current node
    xml.startElement(
            WebDAV.DAV_NS,
            WebDAV.XML_RESPONSE,
            WebDAV.XML_NS_RESPONSE,
            getDAVHelper().getNullAttributes());

    xml.startElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF, getDAVHelper().getNullAttributes());
    xml.write(strHRef);
    xml.endElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF);

    if (failedProperty != null)
    {
        generateError(xml);
    }

    for (PropertyAction propertyAction : m_propertyActions)
    {
        WebDAVProperty property = propertyAction.getProperty();
        int statusCode = propertyAction.getStatusCode();
        String statusCodeDescription = propertyAction.getStatusCodeDescription();
        generatePropertyResponse(xml, property, statusCode, statusCodeDescription);
    }
    
    // Close off the response element
    xml.endElement(WebDAV.DAV_NS, WebDAV.XML_RESPONSE, WebDAV.XML_NS_RESPONSE);
    
    // Close the outer XML element
    xml.endElement(WebDAV.DAV_NS, WebDAV.XML_MULTI_STATUS, WebDAV.XML_NS_MULTI_STATUS);

    // Send remaining data
    flushXML(xml);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:54,代碼來源:PropPatchMethod.java

示例8: executeImpl

import org.dom4j.io.XMLWriter; //導入方法依賴的package包/類
@Override
protected void executeImpl() throws WebDAVServerException, Exception
{
    try
    {
        super.executeImpl();
        m_response.setStatus(HttpServletResponse.SC_NO_CONTENT);
    }
    catch (WebDAVServerException e) 
    {
        if (e.getHttpStatusCode() == WebDAV.WEBDAV_SC_LOCKED)
        {
            // SharePoint requires a special response for the case of
            //  trying to delete a locked document
            m_response.setStatus(WebDAV.WEBDAV_SC_MULTI_STATUS);
            m_response.setContentType(WebDAV.XML_CONTENT_TYPE);
            m_response.addHeader(HEADER_X_MSDAVEXT_ERROR, "589838"); // TODO Don't hard code this constant

            XMLWriter xml = createXMLWriter();

            xml.startDocument();

            String nsdec = generateNamespaceDeclarations(namespaceMap);
            xml.startElement(WebDAV.DAV_NS, WebDAV.XML_MULTI_STATUS + nsdec, WebDAV.XML_NS_MULTI_STATUS + nsdec, getDAVHelper().getNullAttributes());

            xml.startElement(WebDAV.DAV_NS, WebDAV.XML_RESPONSE, WebDAV.XML_NS_RESPONSE, getDAVHelper().getNullAttributes());
            
            xml.startElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF, getDAVHelper().getNullAttributes());
            xml.write(m_request.getRequestURL().toString());
            xml.endElement(WebDAV.DAV_NS, WebDAV.XML_HREF, WebDAV.XML_NS_HREF);
            
            xml.startElement(WebDAV.DAV_NS, WebDAV.XML_STATUS, WebDAV.XML_NS_STATUS, getDAVHelper().getNullAttributes());
            xml.write(WebDAV.HTTP1_1 + " " + WebDAV.WEBDAV_SC_LOCKED + " " + SC_LOCKED_DESC);
            xml.endElement(WebDAV.DAV_NS, WebDAV.XML_STATUS, WebDAV.XML_NS_STATUS);
            
            xml.endElement(WebDAV.DAV_NS, WebDAV.XML_RESPONSE, WebDAV.XML_NS_RESPONSE);

            // Close the outer XML element
            xml.endElement(WebDAV.DAV_NS, WebDAV.XML_MULTI_STATUS, WebDAV.XML_NS_MULTI_STATUS);

            // Send remaining data
            flushXML(xml);
        }
        else
        {
            throw e;
        }
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:50,代碼來源:DeleteMethod.java


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