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


Java XMLAttributes.getName方法代码示例

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


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

示例1: Info

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
 * Creates an element information object.
 * <p>
 * <strong>Note:</strong>
 * This constructor makes a copy of the element information.
 *
 * @param element The element qualified name.
 * @param attributes The element attributes.
 */
public Info(HTMLElements.Element element,
            QName qname, XMLAttributes attributes) {
    this.element = element;
    this.qname = new QName(qname);
    if (attributes != null) {
        int length = attributes.getLength();
        if (length > 0) {
            QName aqname = new QName();
            XMLAttributes newattrs = new XMLAttributesImpl();
            for (int i = 0; i < length; i++) {
                attributes.getName(i, aqname);
                String type = attributes.getType(i);
                String value = attributes.getValue(i);
                String nonNormalizedValue = attributes.getNonNormalizedValue(i);
                boolean specified = attributes.isSpecified(i);
                newattrs.addAttribute(aqname, type, value);
                newattrs.setNonNormalizedValue(i, nonNormalizedValue);
                newattrs.setSpecified(i, specified);
            }
            this.attributes = newattrs;
        }
    }
}
 
开发者ID:carson0321,项目名称:node-boilerpipe,代码行数:33,代码来源:HTMLTagBalancer.java

示例2: startElement

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
public void startElement(QName element, XMLAttributes attributes,
        Augmentations augs) throws XNIException {
    Element elem;
    int attrCount = attributes.getLength();
    if (fDocumentImpl == null) {
        elem = fDocument.createElementNS(element.uri, element.rawname);
        for (int i = 0; i < attrCount; ++i) {
            attributes.getName(i, fAttributeQName);
            elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i));
        }
    }
    // If it's a Xerces DOM store type information for attributes, set idness, etc..
    else {
        elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart);
        for (int i = 0; i < attrCount; ++i) {
            attributes.getName(i, fAttributeQName);
            AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, 
                    fAttributeQName.rawname, fAttributeQName.localpart);
            attr.setValue(attributes.getValue(i));
            elem.setAttributeNodeNS(attr);
            
            // write type information to this attribute
            AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI);
            if (attrPSVI != null) {
                if (fStorePSVI) {
                    ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI);
                }
                Object type = attrPSVI.getMemberTypeDefinition();
                if (type == null) {
                    type = attrPSVI.getTypeDefinition();
                    if (type != null) {
                        attr.setType (type);
                        if (((XSSimpleType) type).isIDType()) {
                            ((ElementImpl) elem).setIdAttributeNode (attr, true);
                        }
                    }
                }
                else {
                    attr.setType (type);
                    if (((XSSimpleType) type).isIDType()) {
                        ((ElementImpl) elem).setIdAttributeNode (attr, true);
                    }
                }
            }
            attr.setSpecified(attributes.isSpecified(i));
        }
    }
    append(elem);
    fCurrentNode = elem;
    if (fFragmentRoot == null) {
        fFragmentRoot = elem;
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:54,代码来源:DOMResultBuilder.java

示例3: printElement

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Prints an element. */
protected void printElement(QName element, XMLAttributes attributes) {

    fOut.print("element=");
    fOut.print('{');
    fOut.print("prefix=");
    printQuotedString(element.prefix);
    fOut.print(',');
    fOut.print("localpart=");
    printQuotedString(element.localpart);
    fOut.print(',');
    fOut.print("rawname=");
    printQuotedString(element.rawname);
    fOut.print(',');
    fOut.print("uri=");
    printQuotedString(element.uri);
    fOut.print('}');
    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) {
                fOut.print(',');
            }
            attributes.getName(i, fQName);
            String attrType = attributes.getType(i);
            String attrValue = attributes.getValue(i);
            String attrNonNormalizedValue = attributes.getNonNormalizedValue(i);
            Augmentations augs = attributes.getAugmentations(i);
            fOut.print("name=");
            fOut.print('{');
            fOut.print("prefix=");
            printQuotedString(fQName.prefix);
            fOut.print(',');
            fOut.print("localpart=");
            printQuotedString(fQName.localpart);
            fOut.print(',');
            fOut.print("rawname=");
            printQuotedString(fQName.rawname);
            fOut.print(',');
            fOut.print("uri=");
            printQuotedString(fQName.uri);
            fOut.print('}');
            fOut.print(',');
            fOut.print("type=");
            printQuotedString(attrType);
            fOut.print(',');
            fOut.print("value=");
            printQuotedString(attrValue);
            fOut.print(',');
            fOut.print("nonNormalizedValue=");
            printQuotedString(attrNonNormalizedValue);
            if (attributes.isSpecified(i) == false ) {
               fOut.print("(default)");
            }
            if (augs != null) {
                fOut.print(',');
                printAugmentations(augs);
            }
            fOut.print('}');
        }
        fOut.print('}');
    }

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

示例4: handleStartElement

import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Handle start element. */
protected void handleStartElement(QName element, XMLAttributes attrs) {

    // handle element and attributes
    element = purifyQName(element);
    int attrCount = attrs != null ? attrs.getLength() : 0;
    for (int i = attrCount-1; i >= 0; i--) {
        // purify attribute name
        attrs.getName(i, fQName);
        attrs.setName(i, purifyQName(fQName));

        // synthesize namespace bindings
        if (fNamespaces) {
            if (!fQName.rawname.equals("xmlns") &&
                !fQName.rawname.startsWith("xmlns:")) {
                // NOTE: Must get attribute name again because the
                //       purifyQName method does not guarantee that
                //       the same QName object is returned. -Ac
                attrs.getName(i, fQName);
                if (fQName.prefix != null && fQName.uri == null) {
                    synthesizeBinding(attrs, fQName.prefix);
                }
            }
        }
    }

    // synthesize namespace bindings
    if (fNamespaces) {
        if (element.prefix != null && element.uri == null) {
            synthesizeBinding(attrs, element.prefix);
        }
    }

    // synthesize doctype declaration
    if (!fSeenRootElement && fSeenDoctype) {
        Augmentations augs = synthesizedAugs();
        super.doctypeDecl(element.rawname, fPublicId, fSystemId, augs);
    }

    // mark start element as seen
    fSeenRootElement = true;

}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:44,代码来源:Purifier.java


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