• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DefaultDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.dom4j.tree.DefaultDocument的典型用法代码示例。如果您正苦于以下问题:Java DefaultDocument类的具体用法?Java DefaultDocument怎么用?Java DefaultDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultDocument类属于org.dom4j.tree包,在下文中一共展示了DefaultDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testNamespaceNodesAreInherited

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
public void testNamespaceNodesAreInherited() throws JaxenException
{
        Namespace ns0 = Namespace.get("p0", "www.acme0.org");
        Namespace ns1 = Namespace.get("p1", "www.acme1.org");
        Namespace ns2 = Namespace.get("p2", "www.acme2.org");
        Element element = new DefaultElement("test", ns1);
        Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
        element.add(attribute);
        Element root = new DefaultElement("root", ns0);
        root.add(element);
        Document doc = new DefaultDocument(root);
        
        XPath xpath = new Dom4jXPath( "/*/*/namespace::node()" );

        List results = xpath.selectNodes( doc );

        assertEquals( 4,
                      results.size() );
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:20,代码来源:DOM4JXPathTest.java


示例2: buildDocument

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
 * @param doc
 */
public void buildDocument(final DefaultDocument doc) {
    // Manifest is the root-node of the document, therefore we need to pass the
    // "doc"
    final DefaultElement manifestElement = new DefaultElement(CPCore.MANIFEST);

    manifestElement.add(new DefaultAttribute(CPCore.IDENTIFIER, this.identifier));
    manifestElement.add(new DefaultAttribute(CPCore.SCHEMALOCATION, this.schemaLocation));
    // manifestElement.setNamespace(this.getNamespace()); //FIXME: namespace

    doc.add(manifestElement);

    if (metadata != null) {
        metadata.buildDocument(manifestElement);
    }
    organizations.buildDocument(manifestElement);
    resources.buildDocument(manifestElement);

}
 
开发者ID:huihoo,项目名称:olat,代码行数:22,代码来源:CPManifest.java


示例3: writeToFile

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
 * writes the manifest.xml
 */
void writeToFile() {
    final String filename = "imsmanifest.xml";
    final OutputFormat format = OutputFormat.createPrettyPrint();

    try {
        VFSLeaf outFile;
        // file may exist
        outFile = (VFSLeaf) cpcore.getRootDir().resolve("/" + filename);
        if (outFile == null) {
            // if not, create it
            outFile = cpcore.getRootDir().createChildLeaf("/" + filename);
        }
        final DefaultDocument manifestDocument = cpcore.buildDocument();
        final XMLWriter writer = new XMLWriter(outFile.getOutputStream(false), format);
        writer.write(manifestDocument);
    } catch (final Exception e) {
        log.error("imsmanifest for ores " + ores.getResourceableId() + "couldn't be written to file.", e);
        throw new OLATRuntimeException(CPOrganizations.class, "Error writing imsmanifest-file", new IOException());
    }
}
 
开发者ID:huihoo,项目名称:olat,代码行数:24,代码来源:ContentPackage.java


示例4: canGetListUsingCorrectListAndSiteName

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
 * ALF-19833: MacOS: Could not save to SharePoint
 */
@Test
public void canGetListUsingCorrectListAndSiteName() throws Exception
{
    VtiSoapRequest soapRequest = Mockito.mock(VtiSoapRequest.class);
    VtiSoapResponse soapResponse = new VtiSoapResponse(new MockHttpServletResponse());//Mockito.mock(VtiSoapResponse.class);
    Element requestElement = Mockito.mock(Element.class);
    SimpleNamespaceContext nc = Mockito.mock(SimpleNamespaceContext.class);

    Element rootElement = new DefaultElement(QName.get("root", "lists", "some://uri"));
    when(soapRequest.getDocument()).thenReturn(new DefaultDocument(rootElement));
    
    // Invoke the method under test.
    listItemsEndpoint.executeListActionDetails(soapRequest, soapResponse,
                "my-site", "documentLibrary", requestElement, nc);
    
    // Check the condition this test is for.
    verify(listHandler).getList("documentLibrary", "my-site");
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:TestAbstractListItemsEndpointTest.java


示例5: testJaxen20AttributeNamespaceNodes

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
public void testJaxen20AttributeNamespaceNodes() throws JaxenException
{

    Namespace ns1 = Namespace.get("p1", "www.acme1.org");
    Namespace ns2 = Namespace.get("p2", "www.acme2.org");
    Element element = new DefaultElement("test", ns1);
    Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
    element.add(attribute); 
    Document doc = new DefaultDocument(element);
    
    XPath xpath = new Dom4jXPath( "//namespace::node()" );
    List results = xpath.selectNodes( doc );
    assertEquals( 3, results.size() );

}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:16,代码来源:DOM4JXPathTest.java


示例6: load

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
*/
  @Override
  public ContentPackage load(final VFSContainer directory, final OLATResourceable ores) {
      final XMLParser parser = new XMLParser();
      ContentPackage cp;

      final VFSLeaf file = (VFSLeaf) directory.resolve("imsmanifest.xml");

      if (file != null) {
          try {
              final DefaultDocument doc = (DefaultDocument) parser.parse(file.getInputStream(), false);
              cp = new ContentPackage(doc, directory, ores);
              // If a wiki is imported or a new cp created, set a unique orga
              // identifier.
              if (cp.getLastError() == null) {
                  if (cp.isOLATContentPackage() && CPCore.OLAT_ORGANIZATION_IDENTIFIER.equals(cp.getFirstOrganizationInManifest().getIdentifier())) {
                      setUniqueOrgaIdentifier(cp);
                  }
              }

          } catch (final OLATRuntimeException e) {
              cp = new ContentPackage(null, directory, ores);
              log.error("Reading imsmanifest failed. Dir: " + directory.getName() + ". Ores: " + ores.getResourceableId(), e);
              cp.setLastError("Exception reading XML for IMS CP: invalid xml-file ( " + directory.getName() + ")");
          }

      } else {
          cp = new ContentPackage(null, directory, ores);
          cp.setLastError("Exception reading XML for IMS CP: IMS-Manifest not found in " + directory.getName());
          log.error("IMS manifiest xml couldn't be found in dir " + directory.getName() + ". Ores: " + ores.getResourceableId(), null);
          throw new OLATRuntimeException(this.getClass(), "The imsmanifest.xml file was not found.", new IOException());
      }
      return cp;
  }
 
开发者ID:huihoo,项目名称:olat,代码行数:36,代码来源:CPManagerImpl.java


示例7: buildDocument

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
 * Returns the DefaultDocument of this CP
 * 
 * @return the xml Document of this CP
 */
public DefaultDocument buildDocument() {
    // if (doc != null) return doc;
    final DefaultDocument newDoc = new DefaultDocument();
    rootNode.buildDocument(newDoc);
    return newDoc;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:12,代码来源:CPCore.java


示例8: correctErrorCodeReturnedWhenSiteNotFound

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
@Test
public void correctErrorCodeReturnedWhenSiteNotFound() throws Exception
{
    VtiSoapRequest soapRequest = Mockito.mock(VtiSoapRequest.class);
    VtiSoapResponse soapResponse = new VtiSoapResponse(new MockHttpServletResponse());//Mockito.mock(VtiSoapResponse.class);
    Element requestElement = Mockito.mock(Element.class);
    SimpleNamespaceContext nc = Mockito.mock(SimpleNamespaceContext.class);
    
    when(nc.translateNamespacePrefixToUri(anyString())).thenReturn("some://uri");
    
    Element rootElement = new DefaultElement("root");
    when(soapRequest.getDocument()).thenReturn(new DefaultDocument(rootElement));
    
    // ALF-19833: listName was being passed to getList for both arguments.
    when(listHandler.getList("documentLibrary", "my-site")).thenThrow(new SiteDoesNotExistException(""));
    
    // Invoke the method under test.
    try
    {
        listItemsEndpoint.executeListActionDetails(soapRequest, soapResponse,
                    "my-site", "documentLibrary", requestElement, nc);
        
        fail("Expected exception was not thrown.");
    }
    catch(VtiSoapException e)
    {
        assertEquals(VtiError.V_LIST_NOT_FOUND.getErrorCode(), e.getErrorCode());
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:TestAbstractListItemsEndpointTest.java


示例9: createJob

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
private Job createJob(long jobID) {
    Job job = mock(Job.class);
    when(job.getJobID()).thenReturn(jobID);
    when(job.getOrigHarvestDefinitionID()).thenReturn(9L);
    when(job.getOrderXMLdoc()).thenReturn(new DefaultDocument());
    return job;
}
 
开发者ID:netarchivesuite,项目名称:netarchivesuite-svngit-migration,代码行数:8,代码来源:JobDispatcherTester.java


示例10: getAdapterSite

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
public static String getAdapterSite(Object document)
		throws DomBuilderException, IOException, TransformerException {
	String input;
	if (document instanceof DefaultDocument) {
		DefaultDocument defaultDocument = (DefaultDocument) document;
		input = defaultDocument.asXML();
	} else {
		input = document.toString();
	}
	return getAdapterSite(input, null);
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:12,代码来源:XmlUtils.java


示例11: getDocument

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
*/
  @Override
  public DefaultDocument getDocument(final ContentPackage cp) {
      return cp.getDocument();
  }
 
开发者ID:huihoo,项目名称:olat,代码行数:7,代码来源:CPManagerImpl.java


示例12: ContentPackage

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
ContentPackage(final DefaultDocument doc, final VFSContainer parent, final OLATResourceable ores) {
    this.cpcore = new CPCore(doc, parent);
    this.ores = ores;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:5,代码来源:ContentPackage.java


示例13: getDocument

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
protected DefaultDocument getDocument() {
    return cpcore.buildDocument();
}
 
开发者ID:huihoo,项目名称:olat,代码行数:4,代码来源:ContentPackage.java


示例14: CPCore

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
public CPCore(final DefaultDocument doc, final VFSContainer rootDir) {
    this.doc = doc;
    this.rootDir = rootDir;
    errors = new Vector<String>();
    buildTree();
}
 
开发者ID:huihoo,项目名称:olat,代码行数:7,代码来源:CPCore.java


示例15: getDocument

import org.dom4j.tree.DefaultDocument; //导入依赖的package包/类
/**
 * Returns the DefaultDocument of the ContentPackage cp
 * 
 * @return the xml Document of the cp
 */
public abstract DefaultDocument getDocument(ContentPackage cp);
 
开发者ID:huihoo,项目名称:olat,代码行数:7,代码来源:CPManager.java



注:本文中的org.dom4j.tree.DefaultDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MetadataProviderException类代码示例发布时间:2022-05-22
下一篇:
Java SQSConnectionFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap