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


Java XMLDoc类代码示例

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


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

示例1: processConfigFile

import com.mycila.xmltool.XMLDoc; //导入依赖的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.XMLDoc; //导入依赖的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.XMLDoc; //导入依赖的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.XMLDoc; //导入依赖的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.XMLDoc; //导入依赖的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: setUp

import com.mycila.xmltool.XMLDoc; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
    knoxLocalCluster = new KnoxLocalCluster.Builder()
            .setPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.KNOX_PORT_KEY)))
            .setPath(propertyParser.getProperty(ConfigVars.KNOX_PATH_KEY))
            .setHomeDir(propertyParser.getProperty(ConfigVars.KNOX_HOME_DIR_KEY))
            .setCluster(propertyParser.getProperty(ConfigVars.KNOX_CLUSTER_KEY))
            .setTopology(XMLDoc.newDocument(true)
                    .addRoot("topology")
                    .addTag("service")
                    .addTag("role").addText("WEBHDFS")
                    .addTag("url").addText("http://localhost:20112/webhdfs")
                    .gotoRoot().toString())
            .build();
}
 
开发者ID:sakserv,项目名称:hadoop-mini-clusters,代码行数:16,代码来源:KnoxLocalClusterTest.java

示例7: canPullRecursively

import com.mycila.xmltool.XMLDoc; //导入依赖的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

示例8: canGetInputVoltage

import com.mycila.xmltool.XMLDoc; //导入依赖的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

示例9: processProfile

import com.mycila.xmltool.XMLDoc; //导入依赖的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.XMLDoc类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。