本文整理匯總了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());
}
}