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


C# AttributeList.getValue方法代码示例

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


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

示例1: startElement

        //throws SAXException
        /**
         * Adapter implementation method; do not call.
         * Adapt a SAX1 startElement event.
         *
         * <p>If necessary, perform Namespace processing.</p>
         *
         * @param qName The qualified (prefixed) name.
         * @param qAtts The XML attribute list (with qnames).
         * @exception SAXException The client may raise a
         *            processing exception.
         */
        public void startElement(String qName, AttributeList qAtts)
        {
            // These are exceptions from the
            // first pass; they should be
            // ignored if there's a second pass,
            // but reported otherwise.
            java.util.Vector<SAXException> exceptions = null;

            // If we're not doing Namespace
            // processing, dispatch this quickly.
            if (!namespaces)
            {
                if (contentHandler != null)
                {
                    attAdapter.setAttributeList(qAtts);
                    contentHandler.startElement("", "", qName.intern(),
                                    attAdapter);
                }
                return;
            }

            // OK, we're doing Namespace processing.
            nsSupport.pushContext();
            int length = qAtts.getLength();

            // First pass:  handle NS decls
            for (int i = 0; i < length; i++)
            {
                String attQName = qAtts.getName(i);

                if (!attQName.startsWith("xmlns"))
                    continue;
                // Could be a declaration...
                String prefix;
                int n = attQName.indexOf(':');

                // xmlns=...
                if (n == -1 && attQName.length() == 5)
                {
                    prefix = "";
                }
                else if (n != 5)
                {
                    // XML namespaces spec doesn't discuss "xmlnsf:oo"
                    // (and similarly named) attributes ... at most, warn
                    continue;
                }
                else 		// xmlns:foo=...
                    prefix = attQName.substring(n + 1);

                String value = qAtts.getValue(i);
                if (!nsSupport.declarePrefix(prefix, value))
                {
                    reportError("Illegal Namespace prefix: " + prefix);
                    continue;
                }
                if (contentHandler != null)
                    contentHandler.startPrefixMapping(prefix, value);
            }

            // Second pass: copy all relevant
            // attributes into the SAX2 AttributeList
            // using updated prefix bindings
            atts.clear();
            for (int i = 0; i < length; i++)
            {
                String attQName = qAtts.getName(i);
                String type = qAtts.getType(i);
                String value = qAtts.getValue(i);

                // Declaration?
                if (attQName.startsWith("xmlns"))
                {
                    String prefix;
                    int n = attQName.indexOf(':');

                    if (n == -1 && attQName.length() == 5)
                    {
                        prefix = "";
                    }
                    else if (n != 5)
                    {
                        // XML namespaces spec doesn't discuss "xmlnsf:oo"
                        // (and similarly named) attributes ... ignore
                        prefix = null;
                    }
                    else
                    {
//.........这里部分代码省略.........
开发者ID:sailesh341,项目名称:JavApi,代码行数:101,代码来源:ParserAdapter.cs

示例2: setAttributeList

        ////////////////////////////////////////////////////////////////////
        // Methods specific to this class.
        ////////////////////////////////////////////////////////////////////
        /**
         * Set the attribute list, discarding previous contents.
         *
         * <p>This method allows an application writer to reuse an
         * attribute list easily.</p>
         *
         * @param atts The attribute list to copy.
         */
        public void setAttributeList(AttributeList atts)
        {
            int count = atts.getLength();

            clear();

            for (int i = 0; i < count; i++)
            {
                addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
            }
        }
开发者ID:sailesh341,项目名称:JavApi,代码行数:22,代码来源:AttributeListImpl.cs


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