当前位置: 首页>>代码示例>>Java>>正文


Java NamespaceSupport.processName方法代码示例

本文整理汇总了Java中org.xml.sax.helpers.NamespaceSupport.processName方法的典型用法代码示例。如果您正苦于以下问题:Java NamespaceSupport.processName方法的具体用法?Java NamespaceSupport.processName怎么用?Java NamespaceSupport.processName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.helpers.NamespaceSupport的用法示例。


在下文中一共展示了NamespaceSupport.processName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testProcessName

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
@Test
public void testProcessName() {
    NamespaceSupport nssupport = new NamespaceSupport();

    nssupport.pushContext();
    nssupport.declarePrefix("", "http://www.java.com");
    nssupport.declarePrefix("dc", "http://www.purl.org/dc");

    String[] parts = new String[3];
    nssupport.processName("dc:name1", parts, false);
    Assert.assertTrue(parts[0].equals("http://www.purl.org/dc"));
    Assert.assertTrue(parts[1].equals("name1"));
    Assert.assertTrue(parts[2].equals("dc:name1"));

    nssupport.processName("name2", parts, false);
    Assert.assertTrue(parts[0].equals("http://www.java.com"));
    Assert.assertTrue(parts[1].equals("name2"));
    Assert.assertTrue(parts[2].equals("name2"));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:NSSupportTest.java

示例2: testPopContext

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
@Test
public void testPopContext() {
    String[] parts = new String[3];
    NamespaceSupport nssupport = new NamespaceSupport();

    nssupport.pushContext();
    nssupport.declarePrefix("dc", "http://www.purl.org/dc");
    Assert.assertEquals(nssupport.getPrefix("http://www.purl.org/dc"), "dc");

    nssupport.popContext();
    Assert.assertNull(nssupport.getPrefix("http://www.purl.org/dc"));
    nssupport.processName("dc:name1", parts, false);
    Assert.assertNull(parts[0]);
    Assert.assertNull(parts[1]);
    Assert.assertNull(parts[2]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:NSSupportTest.java

示例3: testNamespaceDeclUris

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
@Test
public void testNamespaceDeclUris() {
    String[] parts = new String[3];
    NamespaceSupport nssupport = new NamespaceSupport();

    nssupport.pushContext();
    Assert.assertFalse(nssupport.isNamespaceDeclUris());
    nssupport.declarePrefix("xmlns", "");
    nssupport.processName("xmlns:name", parts, true);
    Assert.assertNull(parts[0]);
    Assert.assertNull(parts[1]);
    Assert.assertNull(parts[2]);

    nssupport.reset();

    nssupport.setNamespaceDeclUris(true);
    nssupport.declarePrefix("xmlns", "");
    nssupport.processName("xmlns:name", parts, true);
    Assert.assertTrue(parts[0].equals(NamespaceSupport.NSDECL));
    Assert.assertTrue(parts[1].equals("name"));
    Assert.assertTrue(parts[2].equals("xmlns:name"));

    nssupport.reset();

    nssupport.setNamespaceDeclUris(true);
    nssupport.declarePrefix("xml", "");
    nssupport.processName("xml:name", parts, true);
    Assert.assertTrue(parts[0].equals(NamespaceSupport.XMLNS));
    Assert.assertTrue(parts[1].equals("name"));
    Assert.assertTrue(parts[2].equals("xml:name"));

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:NSSupportTest.java

示例4: testcase02

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
/**
 * Test for NamespaceSupport.getDeclaredPrefixes() and support.processName().
 */
@Test
public void testcase02() {
    String[] parts = new String[3];
    NamespaceSupport support = new NamespaceSupport();

    support.pushContext();
    support.declarePrefix(DC_PREFIX, PURL_URI);
    parts = support.processName("dc:title", parts, false);
    support.popContext();
    assertEquals(parts, new String[]{PURL_URI, "title", "dc:title"});
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:NSSupportTest.java

示例5: testcase03

import org.xml.sax.helpers.NamespaceSupport; //导入方法依赖的package包/类
/**
 * Test for NamespaceSupport.getDeclaredPrefixes() and support.processName().
 */
@Test
public void testcase03() {
    String[] parts = new String[3];
    NamespaceSupport support = new NamespaceSupport();
    support.pushContext();
    support.declarePrefix(EMPTY_PREFIX, W3_URI);
    parts = support.processName("a", parts, false);
    support.popContext();
    assertEquals(parts, new String[]{W3_URI, "a", "a"});
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:NSSupportTest.java


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