當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。