本文整理汇总了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;
}
示例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;
}
示例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());
}
}
示例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;
}
示例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());
}
}
示例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());
}
}