当前位置: 首页>>代码示例>>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;未经允许,请勿转载。