【问题标题】:Parsing XML using DOM Parser使用 DOM Parser 解析 XML
【发布时间】:2015-09-03 16:24:36
【问题描述】:

我正在使用 DOM 解析器来解析 XML。 xml格式为:

<PriceList>
        <PriceTag>
            <Pricing priceCode = "EATIN">
                <Price></Price>
                <Tax
                    taxCode = "ALWAYS"
                    rule = "TAX_CHAIN"
                    entry = "4"/>
            </Pricing>
            <Pricing priceCode = "TAKEOUT">
                <Price></Price>
                <Tax
                    taxCode = "ALWAYS"
                    rule = "TAX_CHAIN"
                    entry = "4"/>
            </Pricing>
            <Pricing priceCode = "OTHER">
                <Price></Price>
                <Tax
                    taxCode = "ALWAYS"
                    rule = "TAX_CHAIN"
                    entry = "4"/>
            </Pricing>
        </PriceTag>
    </PriceList>

如果 priceCode = "EATIN",我想读取价格。

谁能帮我实现这个。

【问题讨论】:

标签: java dom


【解决方案1】:

尝试替换此行 fileName = ((FileSplit)context.getInputSplit()).getPath().toString();fileName = context.getConfiguration().get("mapreduce.input.fileinputformat.inpu‌​tdir", null);

【讨论】:

    猜你喜欢
    • 2012-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 2011-12-05
    • 2012-01-03
    • 2012-11-18
    • 2012-01-10
    相关资源
    最近更新 更多