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


Java KXmlParser.getAttributeValue方法代码示例

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


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

示例1: createAttributeMap

import org.kxml2.io.KXmlParser; //导入方法依赖的package包/类
private Map<String, String> createAttributeMap(KXmlParser parser) {
    Map<String, String> attributeMap = new HashMap<String, String>();
    int attributeCount = parser.getAttributeCount();
    for (int i = 0; i < attributeCount; i++) {
        String attributeName = parser.getAttributeName(i);
        String attributeValue = parser.getAttributeValue(i);
        attributeMap.put(attributeName, attributeValue);
    }
    return attributeMap;
}
 
开发者ID:dryganets,项目名称:vogar,代码行数:11,代码来源:XmlReportReader.java

示例2: getParser

import org.kxml2.io.KXmlParser; //导入方法依赖的package包/类
@Override
public TransactionParser getParser(KXmlParser parser) {
    String namespace = parser.getNamespace();
    String name = parser.getName();

    if("message".equalsIgnoreCase(name)) {
        return new TransactionParser<String>(parser) {

        String nature = parser.getAttributeValue(null, "nature");

        public void commit(String parsed) throws IOException {

        }

        public String parse() throws InvalidStructureException,IOException, XmlPullParserException, UnfullfilledRequirementsException {

                message = parser.nextText();
                if(nature != null) {
                    if(message != null) {
                        messages.put(nature, message);
                    }
                }
                return message;
            }
        };

    }
    // check for super AFTER so that we default to overridden case
    TransactionParser superParser = super.getParser(parser);
    if(superParser != null){
        return superParser;
    }

    return null;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:36,代码来源:J2METransactionParserFactory.java

示例3: processSurveyList

import org.kxml2.io.KXmlParser; //导入方法依赖的package包/类
public void processSurveyList(KXmlParser parser, Hashtable formInfo) throws XmlPullParserException{
    try {
        //boolean inItem = false;
        parser.nextTag();
        parser.require(XmlPullParser.START_TAG, null, "forms");
        while( parser.nextTag() != XmlPullParser.END_TAG ){
            //parser file names
            parser.require(XmlPullParser.START_TAG, null, null);

            String name = parser.getName();
            String url = parser.getAttributeValue(null, "url");
            String text = parser.nextText();

            if(name.equals("form"))
                {
                //inItem = true;
                //items.addElement(text);
                formInfo.put(text, url);
                }
            else
                //inItem = false;

            parser.require(XmlPullParser.END_TAG, null, "form");
        }
        parser.require(XmlPullParser.END_TAG, null, "forms");

        parser.next();
        parser.require(XmlPullParser.END_DOCUMENT, null, null);

    } catch (IOException e) {
        // TODO: handle exception
        System.out.println("XML parser error");
        e.printStackTrace();

    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:37,代码来源:DisplayFormsHttpState.java

示例4: getParser

import org.kxml2.io.KXmlParser; //导入方法依赖的package包/类
@Override
public TransactionParser getParser(KXmlParser parser) {
    String namespace = parser.getNamespace();
    String name = parser.getName();
    if (LedgerXmlParsers.STOCK_XML_NAMESPACE.equals(namespace)) {
        if (stockParser == null) {
            throw new RuntimeException("Couldn't process Stock transaction without initialization!");
        }
        req();
        return stockParser.getParser(parser);
    } else if ("case".equalsIgnoreCase(name)) {
        if (caseParser == null) {
            throw new RuntimeException("Couldn't receive Case transaction without initialization!");
        }
        req();
        return caseParser.getParser(parser);
    } else if ("registration".equalsIgnoreCase(name)) {
        if (userParser == null) {
            throw new RuntimeException("Couldn't receive User transaction without initialization!");
        }
        req();
        return userParser.getParser(parser);
    } else if (FixtureIndexSchemaParser.INDICE_SCHEMA.equalsIgnoreCase(name)) {
        return new FixtureIndexSchemaParser(parser, fixtureSchemas, processedFixtures);
    } else if ("fixture".equalsIgnoreCase(name)) {
        String id = parser.getAttributeValue(null, "id");
        String isIndexedAttr = parser.getAttributeValue(null, "indexed");
        boolean isIndexed = "true".equals(isIndexedAttr);
        req();
        processedFixtures.add(id);
        if (isIndexed) {
            FixtureIndexSchema schema = fixtureSchemas.get(id);
            return new IndexedFixtureXmlParser(parser, id, schema, sandbox);
        } else {
            return fixtureParser.getParser(parser);
        }
    } else if ("sync".equalsIgnoreCase(name) &&
            "http://commcarehq.org/sync".equals(namespace)) {
        return new TransactionParser<String>(parser) {

            @Override
            public void commit(String parsed) throws IOException {
            }

            @Override
            public String parse() throws InvalidStructureException,
                    IOException, XmlPullParserException,
                    UnfullfilledRequirementsException {
                this.checkNode("sync");
                this.nextTag("restore_id");
                String syncToken = parser.nextText();
                if (syncToken == null) {
                    throw new InvalidStructureException("Sync block must contain restore_id with valid ID inside!", parser);
                }
                sandbox.setSyncToken(syncToken);
                return syncToken;
            }

        };
    }
    return null;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:63,代码来源:CommCareTransactionParserFactory.java


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