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

Java XMLTag类代码示例

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

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



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

示例1: processConfigFile

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
public void processConfigFile(Engine engine, File configFile) throws ValidatorConfigurationException {
    XMLTag doc = XMLDoc.from(configFile, true);
    int ruleCounter = 0;
    for (Element childEl : doc.getChildElement()) {
        String elementName = childEl.getTagName();
        switch (elementName) {
            case "pattern-def":
                processNamedPatternDefinition(engine, childEl);
                break;
            case "value-def":
                processNamedValueDefinition(engine, childEl);
                break;
            case "rules-section":
                processRulesSectionDefinition(engine, childEl, ruleCounter++);
                break;
            case "namespaces":
                processNamespaces(engine, childEl);
            default:
                //nothing
                //System.out.println(String.format("ignoring element %s", elementName));
        }
    }
}
 
开发者ID:NLCR,项目名称:komplexni-validator,代码行数:24,代码来源:ConfigProcessor.java


示例2: canPull

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
@Test
public void canPull() throws InterruptedException {
    stubFor(post(urlEqualTo("/wsman"))
            .willReturn(aResponse()
                .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                .withBodyFile("pull-response.xml")));

    List<Node> nodes = Lists.newArrayList();
    client.pull("c6595ee1-2664-1664-801f-c115cfb5fe14", WSManConstants.CIM_ALL_AVAILABLE_CLASSES, nodes, false);

    dumpRequestsToStdout();

    assertEquals(1, nodes.size());

    XMLTag tag = XMLDoc.from(nodes.get(0), true);
    int inputVoltage = Integer.valueOf(tag.gotoChild("n1:InputVoltage").getText());
    assertEquals(120, inputVoltage);
}
 
开发者ID:OpenNMS,项目名称:wsman,代码行数:19,代码来源:AbstractWSManClientIT.java


示例3: canGet

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
@Test
public void canGet() throws FileNotFoundException, IOException {
    stubFor(post(urlEqualTo("/wsman"))
            .willReturn(aResponse()
                .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                .withBodyFile("get-response.xml")));

    Map<String, String> selectors = Maps.newHashMap();
    selectors.put("CreationClassName", "DCIM_ComputerSystem");
    selectors.put("Name", "srv:system");
    Node node = client.get("http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_ComputerSystem", selectors);

    dumpRequestsToStdout();

    assertNotNull(node);

    XMLTag tag = XMLDoc.from(node, true);
    int primaryStatus = Integer.valueOf(tag.gotoChild("n1:PrimaryStatus").getText());
    assertEquals(1, primaryStatus);
}
 
开发者ID:OpenNMS,项目名称:wsman,代码行数:21,代码来源:AbstractWSManClientIT.java


示例4: canGetSystemPrimaryStatus

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
@Test
public void canGetSystemPrimaryStatus() throws FileNotFoundException, IOException {
    Map<String, String> selectors = Maps.newHashMap();
    selectors.put("CreationClassName", "DCIM_ComputerSystem");
    selectors.put("Name", "srv:system");
    Node node = client.get("http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_ComputerSystem", selectors);
    assertNotNull(node);

    assertEquals("DCIM_ComputerSystem", node.getLocalName());
    assertEquals("http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_ComputerSystem", node.getNamespaceURI());

    XMLTag tag = XMLDoc.from(node, true);
    System.err.println(tag.getCurrentTagName());
    System.err.println(tag);
    int primaryStatus = Integer.valueOf(tag.gotoChild("n1:PrimaryStatus").getText());
    assertEquals(1, primaryStatus);
}
 
开发者ID:OpenNMS,项目名称:wsman,代码行数:18,代码来源:AbstractWSManClientDracIT.java


示例5: parseProfile

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
public MetadataProfile parseProfile(File profileXmlFile) throws ValidatorConfigurationException {
    //LOG.info(String.format("parsing %s", templateXml.getAbsolutePath()));
    MetadataProfile metadataProfile = new MetadataProfile();
    XMLTag doc = XMLDoc.from(profileXmlFile, true); //ignoring namespaces
    metadataProfile.setValidatorVersion(doc.getAttribute("validatorVersion"));
    metadataProfile.setDmf(doc.getAttribute("dmf"));

    checkValidatorVersionCorrect(metadataProfile.getValidatorVersion(), profileXmlFile);
    //TODO: podobne testovat dmf

    for (Element childEl : doc.getChildElement()) {
        String elementName = childEl.getTagName();
        switch (elementName) {
            case "info": //won't be machine processed
                break;
            case "namespaces":
                metadataProfile.setNamespaces(parseNamespaces(childEl));
                break;
            case "dictionaries":
                metadataProfile.setDeclaredDictionaries(parseDeclaredDictionaries(childEl, profileXmlFile));
                break;
            case "rootElement":
                ExpectedElementDefinition rootElementDef = parseElementDefinition(metadataProfile, null, childEl, profileXmlFile);
                rootElementDef.setRepeatable(false); //quick fix
                metadataProfile.setRootElementDefinition(rootElementDef);
                break;
            default:
                //nothing
        }
    }
    return metadataProfile;
}
 
开发者ID:NLCR,项目名称:komplexni-validator,代码行数:33,代码来源:MetadataProfileParser.java


示例6: canPullRecursively

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
@Test
public void canPullRecursively() throws InterruptedException {
    stubFor(post(urlEqualTo("/wsman")).inScenario("Recursive pull")
            .whenScenarioStateIs(Scenario.STARTED)
            .willReturn(aResponse()
                .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                .withBodyFile("recursive-pull-response-1.xml"))
            .willSetStateTo("Pull #2"));

    stubFor(post(urlEqualTo("/wsman")).inScenario("Recursive pull")
            .whenScenarioStateIs("Pull #2")
            .willReturn(aResponse()
                .withHeader("Content-Type", "Content-Type: application/soap+xml; charset=utf-8")
                .withBodyFile("recursive-pull-response-2.xml")));

    List<Node> nodes = Lists.newArrayList();
    client.pull("c6595ee1-2664-1664-801f-c115cfb5fe14", WSManConstants.CIM_ALL_AVAILABLE_CLASSES, nodes, true);

    dumpRequestsToStdout();

    assertEquals(2, nodes.size());

    XMLTag tag = XMLDoc.from(nodes.get(0), true);
    int inputVoltage = Integer.valueOf(tag.gotoChild("n1:InputVoltage").getText());
    assertEquals(120, inputVoltage);

    tag = XMLDoc.from(nodes.get(1), true);
    inputVoltage = Integer.valueOf(tag.gotoChild("n1:InputVoltage").getText());
    assertEquals(121, inputVoltage);
}
 
开发者ID:OpenNMS,项目名称:wsman,代码行数:31,代码来源:AbstractWSManClientIT.java


示例7: canGetInputVoltage

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
@Test
public void canGetInputVoltage() {
    List<Node> powerSupplies = Lists.newLinkedList();
    client.enumerateAndPullUsingFilter(
            WSManConstants.CIM_ALL_AVAILABLE_CLASSES,
            WSManConstants.XML_NS_WQL_DIALECT,
            "select DeviceDescription,PrimaryStatus,TotalOutputPower,InputVoltage,Range1MaxInputPower,FirmwareVersion,RedundancyStatus from DCIM_PowerSupplyView where DetailedState != 'Absent' and PrimaryStatus != 0",
            powerSupplies,
            true);
    assertEquals(1, powerSupplies.size());

    XMLTag tag = XMLDoc.from(powerSupplies.get(0), true);
    int inputVoltage = Integer.valueOf(tag.gotoChild("n1:InputVoltage").getText());
    assertEquals(120, inputVoltage);
}
 
开发者ID:OpenNMS,项目名称:wsman,代码行数:16,代码来源:AbstractWSManClientDracIT.java


示例8: processProfile

import com.mycila.xmltool.XMLTag; //导入依赖的package包/类
private void processProfile(ImageUtil util, File profileDefinitionFile, Map<ImageUtil, J2kProfile> profiles) throws ValidatorConfigurationException {
    XMLTag doc = XMLDoc.from(profileDefinitionFile, true);
    J2kProfile profile = buildProfile(util, doc.getCurrentTag());
    profiles.put(util, profile);
}
 
开发者ID:NLCR,项目名称:komplexni-validator,代码行数:6,代码来源:ImageValidator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FactoryBlockPattern类代码示例发布时间:2022-05-22
下一篇:
Java BlockTermState类代码示例发布时间: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