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


Java AttributeList.getValue方法代码示例

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


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

示例1: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * The SAX <code>startElement</code> method.
 *
 * <p>The catalog parser is selected based on the namespace of the
 * first element encountered in the catalog.</p>
 */
public void startElement (String name,
                          AttributeList atts)
  throws SAXException {

  if (abandonHope) {
    return;
  }

  if (saxParser == null) {
    String prefix = "";
    if (name.indexOf(':') > 0) {
      prefix = name.substring(0, name.indexOf(':'));
    }

    String localName = name;
    if (localName.indexOf(':') > 0) {
      localName = localName.substring(localName.indexOf(':')+1);
    }

    String namespaceURI = null;
    if (prefix.equals("")) {
      namespaceURI = atts.getValue("xmlns");
    } else {
      namespaceURI = atts.getValue("xmlns:" + prefix);
    }

    String saxParserClass = getCatalogParser(namespaceURI,
                                             localName);

    if (saxParserClass == null) {
      abandonHope = true;
      if (namespaceURI == null) {
        debug.message(2, "No Catalog parser for " + name);
      } else {
        debug.message(2, "No Catalog parser for "
                      + "{" + namespaceURI + "}"
                      + name);
      }
      return;
    }

    try {
      saxParser = (SAXCatalogParser)
        ReflectUtil.forName(saxParserClass).newInstance();

      saxParser.setCatalog(catalog);
      saxParser.startDocument();
      saxParser.startElement(name, atts);
    } catch (ClassNotFoundException cnfe) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, cnfe.toString());
    } catch (InstantiationException ie) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, ie.toString());
    } catch (IllegalAccessException iae) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, iae.toString());
    } catch (ClassCastException cce ) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, cce.toString());
    }
  } else {
    saxParser.startElement(name, atts);
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:76,代码来源:SAXCatalogReader.java

示例2: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * The SAX <code>startElement</code> method.
 *
 * <p>The catalog parser is selected based on the namespace of the
 * first element encountered in the catalog.</p>
 */
public void startElement (String name,
        AttributeList atts)
                throws SAXException {

    if (abandonHope) {
        return;
    }

    if (saxParser == null) {
        String prefix = "";
        if (name.indexOf(':') > 0) {
            prefix = name.substring(0, name.indexOf(':'));
        }

        String localName = name;
        if (localName.indexOf(':') > 0) {
            localName = localName.substring(localName.indexOf(':')+1);
        }

        String namespaceURI = null;
        if (prefix.length() == 0) {
            namespaceURI = atts.getValue("xmlns");
        } else {
            namespaceURI = atts.getValue("xmlns:" + prefix);
        }

        String saxParserClass = getCatalogParser(namespaceURI,
                localName);

        if (saxParserClass == null) {
            abandonHope = true;
            if (namespaceURI == null) {
                debug.message(2, "No Catalog parser for " + name);
            } else {
                debug.message(2, "No Catalog parser for "
                        + "{" + namespaceURI + "}"
                        + name);
            }
            return;
        }

        try {
            saxParser = (SAXCatalogParser)
                    ReflectUtil.forName(saxParserClass).newInstance();

            saxParser.setCatalog(catalog);
            saxParser.startDocument();
            saxParser.startElement(name, atts);
        } catch (ClassNotFoundException cnfe) {
            saxParser = null;
            abandonHope = true;
            debug.message(2, cnfe.toString());
        } catch (InstantiationException ie) {
            saxParser = null;
            abandonHope = true;
            debug.message(2, ie.toString());
        } catch (IllegalAccessException iae) {
            saxParser = null;
            abandonHope = true;
            debug.message(2, iae.toString());
        } catch (ClassCastException cce ) {
            saxParser = null;
            abandonHope = true;
            debug.message(2, cce.toString());
        }
    } else {
        saxParser.startElement(name, atts);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:76,代码来源:SAXCatalogReader.java

示例3: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
  * The SAX <code>startElement</code> method.
  *
  * <p>The catalog parser is selected based on the namespace of the
  * first element encountered in the catalog.</p>
  */
 public void startElement (String name,
		    AttributeList atts)
   throws SAXException {

   if (abandonHope) {
     return;
   }

   if (saxParser == null) {
     String prefix = "";
     if (name.indexOf(':') > 0) {
prefix = name.substring(0, name.indexOf(':'));
     }

     String localName = name;
     if (localName.indexOf(':') > 0) {
localName = localName.substring(localName.indexOf(':')+1);
     }

     String namespaceURI = null;
     if (prefix.equals("")) {
namespaceURI = atts.getValue("xmlns");
     } else {
namespaceURI = atts.getValue("xmlns:" + prefix);
     }

     String saxParserClass = getCatalogParser(namespaceURI,
				       localName);

     if (saxParserClass == null) {
abandonHope = true;
if (namespaceURI == null) {
  debug.message(2, "No Catalog parser for " + name);
} else {
  debug.message(2, "No Catalog parser for "
		+ "{" + namespaceURI + "}"
		+ name);
}
return;
     }

     try {
saxParser = (SAXCatalogParser)
  Class.forName(saxParserClass, true, loader != null ? loader : this.getClass().getClassLoader()).newInstance();

saxParser.setCatalog(catalog);
saxParser.startDocument();
saxParser.startElement(name, atts);
     } catch (ClassNotFoundException cnfe) {
saxParser = null;
abandonHope = true;
debug.message(2, cnfe.toString());
     } catch (InstantiationException ie) {
saxParser = null;
abandonHope = true;
debug.message(2, ie.toString());
     } catch (IllegalAccessException iae) {
saxParser = null;
abandonHope = true;
debug.message(2, iae.toString());
     } catch (ClassCastException cce ) {
saxParser = null;
abandonHope = true;
debug.message(2, cce.toString());
     }
   } else {
     saxParser.startElement(name, atts);
   }
 }
 
开发者ID:MaTriXy,项目名称:xerces-for-android,代码行数:76,代码来源:SAXCatalogReader.java

示例4: init

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * Initialisation routine called after handler creation
 * with the element name and attributes. The attributes which
 * this handler can deal with are: <code>"default"</code>,
 * <code>"name"</code>, <code>"id"</code> and <code>"basedir"</code>.
 *
 * @param tag Name of the element which caused this handler
 *            to be created. Should not be <code>null</code>.
 *            Ignored in this implementation.
 * @param attrs Attributes of the element which caused this
 *              handler to be created. Must not be <code>null</code>.
 *
 * @exception SAXParseException if an unexpected attribute is
 *            encountered or if the <code>"default"</code> attribute
 *            is missing.
 */
public void init(String tag, AttributeList attrs) throws SAXParseException {
    String def = null;
    String name = null;
    String id = null;
    String baseDir = null;

    for (int i = 0; i < attrs.getLength(); i++) {
        String key = attrs.getName(i);
        String value = attrs.getValue(i);

        if ("default".equals(key)) {
            def = value;
        } else if ("name".equals(key)) {
            name = value;
        } else if ("id".equals(key)) {
            id = value;
        } else if ("basedir".equals(key)) {
            baseDir = value;
        } else {
            throw new SAXParseException(
                    "Unexpected attribute \"" + attrs.getName(i)
                    + "\"", helperImpl.locator);
        }
    }

    if (def != null && !def.isEmpty()) {
        helperImpl.project.setDefault(def);
    } else {
        throw new BuildException("The default attribute is required");
    }

    if (name != null) {
        helperImpl.project.setName(name);
        helperImpl.project.addReference(name, helperImpl.project);
    }

    if (id != null) {
        helperImpl.project.addReference(id, helperImpl.project);
    }

    if (helperImpl.project.getProperty("basedir") != null) {
        helperImpl.project.setBasedir(helperImpl.project.getProperty("basedir"));
    } else {
        if (baseDir == null) {
            helperImpl.project.setBasedir(helperImpl.buildFileParent.getAbsolutePath());
        } else {
            // check whether the user has specified an absolute path
            if ((new File(baseDir)).isAbsolute()) {
                helperImpl.project.setBasedir(baseDir);
            } else {
                File resolvedBaseDir = FILE_UTILS.resolveFile(helperImpl.buildFileParent,
                        baseDir);
                helperImpl.project.setBaseDir(resolvedBaseDir);
            }
        }
    }

    helperImpl.project.addTarget("", helperImpl.implicitTarget);
}
 
开发者ID:apache,项目名称:ant,代码行数:76,代码来源:ProjectHelperImpl.java

示例5: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/** Start element. */
public void startElement(String name, AttributeList attributes)
    throws SAXException {

    printIndent();
    fOut.print("startElement(");
    fOut.print("name=");
    printQuotedString(name);
    fOut.print(',');
    fOut.print("attributes=");
    if (attributes == null) {
        fOut.println("null");
    }
    else {
        fOut.print('{');
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            if (i > 0) {
                System.out.print(',');
            }
            String attrName = attributes.getName(i);
            String attrType = attributes.getType(i);
            String attrValue = attributes.getValue(i);
            fOut.print('{');
            fOut.print("name=");
            printQuotedString(attrName);
            fOut.print(',');
            fOut.print("type=");
            printQuotedString(attrType);
            fOut.print(',');
            fOut.print("value=");
            printQuotedString(attrValue);
            fOut.print('}');
        }
        fOut.print('}');
    }
    fOut.println(')');
    fOut.flush();
    fIndent++;

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:42,代码来源:DocumentTracer.java

示例6: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * The SAX <code>startElement</code> method.
 *
 * <p>The catalog parser is selected based on the namespace of the
 * first element encountered in the catalog.</p>
 */
public void startElement (String name,
                          AttributeList atts)
  throws SAXException {

  if (abandonHope) {
    return;
  }

  if (saxParser == null) {
    String prefix = "";
    if (name.indexOf(':') > 0) {
      prefix = name.substring(0, name.indexOf(':'));
    }

    String localName = name;
    if (localName.indexOf(':') > 0) {
      localName = localName.substring(localName.indexOf(':')+1);
    }

    String namespaceURI = null;
    if (prefix.equals("")) {
      namespaceURI = atts.getValue("xmlns");
    } else {
      namespaceURI = atts.getValue("xmlns:" + prefix);
    }

    String saxParserClass = getCatalogParser(namespaceURI,
                                             localName);

    if (saxParserClass == null) {
      abandonHope = true;
      if (namespaceURI == null) {
        debug.message(2, "No Catalog parser for " + name);
      } else {
        debug.message(2, "No Catalog parser for "
                      + "{" + namespaceURI + "}"
                      + name);
      }
      return;
    }

    try {
      saxParser = (SAXCatalogParser)
        Class.forName(saxParserClass).newInstance();

      saxParser.setCatalog(catalog);
      saxParser.startDocument();
      saxParser.startElement(name, atts);
    } catch (ClassNotFoundException cnfe) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, cnfe.toString());
    } catch (InstantiationException ie) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, ie.toString());
    } catch (IllegalAccessException iae) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, iae.toString());
    } catch (ClassCastException cce ) {
      saxParser = null;
      abandonHope = true;
      debug.message(2, cce.toString());
    }
  } else {
    saxParser.startElement(name, atts);
  }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:76,代码来源:SAXCatalogReader.java

示例7: startElement

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * Receive notification of the start of an element.
 *
 * @param name the element type name.
 * @param attributes the specified or defaulted attributes.
 */
public void startElement(String name, AttributeList atts) throws SAXException
{
  _nestingLevel++;

  // startBundle doesn't go in the startDocument method because it
  // requires metadata to be passed and in particular, requires
  // at least the package for any implementation of startBundle to work
  if ((_nestingLevel == 2) && name.equals("resource"))
  {
    if (_startDoc)
    {
      try
      {
        _bundleWriter.startBundle(_parms, _metaHt);
        _startDoc = false;
      }
      catch (Throwable th)
      {
        throw new SAXException("startBundle Exception: " + th.getMessage());
      }
    }

    _currentResourceKey = atts.getValue("key");
    if (_uniqKeys.contains(_currentResourceKey))
    {
      System.err.println("Duplicate id \"" + _currentResourceKey + "\"");
    }

    _uniqKeys.add(_currentResourceKey);
    

    _currentResourceValue = new StringBuilder();
  }
  else if ((_nestingLevel == 1) && name.equals("resources"))
  {
    _metaHt.put("package", atts.getValue("package"));
    if (atts.getValue("version") != null)
      _metaHt.put("version", atts.getValue("version"));
    if (atts.getValue("baseversion") != null)
      _metaHt.put("baseVersion", atts.getValue("baseversion"));
  }
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:49,代码来源:XRTSParser.java

示例8: configureId

import org.xml.sax.AttributeList; //导入方法依赖的package包/类
/**
 * Scans an attribute list for the <code>id</code> attribute and
 * stores a reference to the target object in the project if an
 * id is found.
 * <p>
 * This method was moved out of the configure method to allow
 * it to be executed at parse time.
 *
 * @see #configure(Object,AttributeList,Project)
 */
private void configureId(Object target, AttributeList attr) {
    String id = attr.getValue("id");
    if (id != null) {
        project.addReference(id, target);
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:ProjectHelperImpl.java


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