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


Java XMLAttributes.getQName方法代码示例

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


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

示例1: parseAttributes

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
private void parseAttributes(XMLAttributes attrs, Stack<String> langStack, Stack<String> xmlBaseStack) {
    if (attrs.getLength() > 0) attributeList = new ReaderAttributeList();
    String u, n, v;
    for (int i = 0; i < attrs.getLength(); i++) {
        u = attrs.getURI(i);
        n = attrs.getQName(i);
        v = attrs.getValue(i);
        if (isNamespace(n)) {
            if (namespaces == null) namespaces = new HashMap<String, String>();
            namespaces.put(n, v);
        } else {
            if (lang == null) lang = resolveLang(n, v, langStack);
            if (xmlBase == null) xmlBase = resolveXmlBase(n, v, xmlBaseStack);
        }
        attributeList.add(u, n, v);
        attributeStrings.add(n + "=\"" + v + "\"");
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:19,代码来源:ReaderNode.java

示例2: startElement

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
 * The start of an element. If the document specifies the start element
 * by using an empty tag, then the startElement method will immediately
 * be followed by the endElement method, with no intervening methods.
 * Overriding the parent to handle DOM_NAMESPACE_DECLARATIONS=false.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startElement (QName element, XMLAttributes attributes, Augmentations augs) {
    // namespace declarations parameter has no effect if namespaces is false.
    if (!fNamespaceDeclarations && fNamespaceAware) {
        int len = attributes.getLength();
        for (int i = len - 1; i >= 0; --i) {
            if (XMLSymbols.PREFIX_XMLNS == attributes.getPrefix(i) ||
                XMLSymbols.PREFIX_XMLNS == attributes.getQName(i)) {
                attributes.removeAttributeAt(i);
            }
        }
    }
    super.startElement(element, attributes, augs);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:26,代码来源:DOMParserImpl.java

示例3: hasNonSchemaAttributes

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
 * @param attributes
 * @return
 */
private boolean hasNonSchemaAttributes(QName element, XMLAttributes attributes) {
    final int length = attributes.getLength();
    for (int i = 0; i < length; ++i) {
        String uri = attributes.getURI(i);
        if (uri != null && uri != SchemaSymbols.URI_SCHEMAFORSCHEMA && 
                uri != NamespaceContext.XMLNS_URI &&
                !(uri == NamespaceContext.XML_URI && 
                        attributes.getQName(i) == SchemaSymbols.ATT_XML_LANG && element.localpart == SchemaSymbols.ELT_SCHEMA)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:SchemaDOMParser.java

示例4: startElement

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs,
                         Augmentations augs) throws XNIException {
    Element elementNode = fDocument.createElement(element.rawname);
    int count = attrs != null ? attrs.getLength() : 0;
    for (int i = 0; i < count; i++) {
        String aname = attrs.getQName(i);
        String avalue = attrs.getValue(i);
        if (XMLChar.isValidName(aname)) {
        	elementNode.setAttribute(aname, avalue);
        }
    }
    fCurrentNode.appendChild(elementNode);
    fCurrentNode = elementNode;
}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:16,代码来源:DOMFragmentParser.java

示例5: startAnnotation

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");
    
    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ? 
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:44,代码来源:SchemaDOM.java


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