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


Java Attribute.getDTDType方法代码示例

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


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

示例1: getAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    attrs.clear();

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (Attribute)i.next();

        QName name = staxAttr.getName();
        String uri = fixNull(name.getNamespaceURI());
        String localName = name.getLocalPart();
        String prefix = name.getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0)
            qName = localName;
        else
            qName = prefix + ':' + localName;
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:StAXEventConnector.java

示例2: getAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    AttributesImpl attrs = new AttributesImpl();

    if ( !event.isStartElement() ) {
        throw new InternalError(
            "getAttributes() attempting to process: " + event);
    }

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next();

        String uri = staxAttr.getName().getNamespaceURI();
        if (uri == null) {
            uri = "";
        }
        String localName = staxAttr.getName().getLocalPart();
        String prefix = staxAttr.getName().getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0) {
            qName = localName;
        } else {
            qName = prefix + ':' + localName;
        }
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();

        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:StAXEvent2SAX.java

示例3: fillXMLAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
private void fillXMLAttributes(StartElement event) {
    fAttributes.removeAllAttributes();
    final Iterator attrs = event.getAttributes();
    while (attrs.hasNext()) {
        Attribute attr = (Attribute) attrs.next();
        fillQName(fAttributeQName, attr.getName());
        String type = attr.getDTDType();
        int idx = fAttributes.getLength();
        fAttributes.addAttributeNS(fAttributeQName,
                (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue());
        fAttributes.setSpecified(idx, attr.isSpecified());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:StAXSchemaParser.java

示例4: getAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
/**
 * Get the attributes associated with the given START_ELEMENT StAXevent.
 *
 * @return the StAX attributes converted to an org.xml.sax.Attributes
 */
private Attributes getAttributes(StartElement event) {
    attrs.clear();

    // in SAX, namespace declarations are not part of attributes by default.
    // (there's a property to control that, but as far as we are concerned
    // we don't use it.) So don't add xmlns:* to attributes.

    // gather non-namespace attrs
    for (Iterator i = event.getAttributes(); i.hasNext();) {
        Attribute staxAttr = (Attribute)i.next();

        QName name = staxAttr.getName();
        String uri = fixNull(name.getNamespaceURI());
        String localName = name.getLocalPart();
        String prefix = name.getPrefix();
        String qName;
        if (prefix == null || prefix.length() == 0)
            qName = localName;
        else
            qName = prefix + ':' + localName;
        String type = staxAttr.getDTDType();
        String value = staxAttr.getValue();
        
        attrs.addAttribute(uri, localName, qName, type, value);
    }

    return attrs;
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:34,代码来源:StAXEventConnector.java

示例5: fillXMLAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
/** Fills in the XMLAttributes object. */
private void fillXMLAttributes(StartElement event) {
    fAttributes.removeAllAttributes();
    final Iterator attrs = event.getAttributes();
    while (attrs.hasNext()) {
        Attribute attr = (Attribute) attrs.next();
        fillQName(fAttributeQName, attr.getName());
        String type = attr.getDTDType();
        int idx = fAttributes.getLength();
        fAttributes.addAttributeNS(fAttributeQName, 
                (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue());
        fAttributes.setSpecified(idx, attr.isSpecified());
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:15,代码来源:StAXValidatorHelper.java

示例6: fillXMLAttributes

import javax.xml.stream.events.Attribute; //导入方法依赖的package包/类
private void fillXMLAttributes(StartElement event) {
    fAttributes.removeAllAttributes();
    final Iterator attrs = event.getAttributes();
    while (attrs.hasNext()) {
        Attribute attr = (Attribute) attrs.next();
        fillQName(fAttributeQName, attr.getName());
        String type = attr.getDTDType();
        int idx = fAttributes.getLength();
        fAttributes.addAttributeNS(fAttributeQName, 
                (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue());
        fAttributes.setSpecified(idx, attr.isSpecified());
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:14,代码来源:StAXSchemaParser.java


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