本文整理了Java中nu.xom.Attribute.getNamespaceURI()
方法的一些代码示例,展示了Attribute.getNamespaceURI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getNamespaceURI()
方法的具体详情如下:
包路径:nu.xom.Attribute
类名称:Attribute
方法名:getNamespaceURI
[英]Returns the namespace URI of this attribute, or the empty string if this attribute is not in a namespace.
[中]返回此属性的命名空间URI,如果此属性不在命名空间中,则返回空字符串。
代码示例来源:origin: jaxen/jaxen
public String getAttributeNamespaceUri(Object o) {
return (isAttribute(o) ? ((Attribute)o).getNamespaceURI() : null);
}
代码示例来源:origin: jaxen/jaxen
public String getNamespaceStringValue(Object o) {
if (isElement(o)) {
return ((Element)o).getNamespaceURI();
} else if (isAttribute(o)) {
return ((Attribute)o).getNamespaceURI();
} else if (o instanceof XPathNamespace) {
return ((XPathNamespace)o).getNamespaceURI();
}
return null;
}
代码示例来源:origin: org.jboss.teiid/teiid-engine
/**
* Get the URI part of the name of this node. This is the URI corresponding
* to the prefix, or the URI of the default namespace if appropriate.
*
* @return The URI of the namespace of this node. For an unnamed node, or
* for a node with an empty prefix, return an empty string.
*/
public String getURI() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getNamespaceURI();
case Type.ATTRIBUTE:
return ((Attribute) node).getNamespaceURI();
default:
return "";
}
}
代码示例来源:origin: org.teiid/saxon-xom
/**
* Get the URI part of the name of this node. This is the URI corresponding
* to the prefix, or the URI of the default namespace if appropriate.
*
* @return The URI of the namespace of this node. For an unnamed node, or
* for a node with an empty prefix, return an empty string.
*/
public String getURI() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getNamespaceURI();
case Type.ATTRIBUTE:
return ((Attribute) node).getNamespaceURI();
default:
return "";
}
}
代码示例来源:origin: teiid/teiid
/**
* Get the URI part of the name of this node. This is the URI corresponding
* to the prefix, or the URI of the default namespace if appropriate.
*
* @return The URI of the namespace of this node. For an unnamed node, or
* for a node with an empty prefix, return an empty string.
*/
public String getURI() {
switch (nodeKind) {
case Type.ELEMENT:
return ((Element) node).getNamespaceURI();
case Type.ATTRIBUTE:
return ((Attribute) node).getNamespaceURI();
default:
return "";
}
}
代码示例来源:origin: DSpace/DSpace
public XmlName(Attribute attribute) {
this.prefix = attribute.getNamespacePrefix();
this.localName = attribute.getLocalName();
this.namespace = attribute.getNamespaceURI();
}
代码示例来源:origin: org.swordapp/sword-common
public XmlName(Attribute attribute)
{
this.prefix = attribute.getNamespacePrefix();
this.localName = attribute.getLocalName();
this.namespace = attribute.getNamespaceURI();
}
代码示例来源:origin: org.dspace/dspace-sword-api
public XmlName(Attribute attribute)
{
this.prefix = attribute.getNamespacePrefix();
this.localName = attribute.getLocalName();
this.namespace = attribute.getNamespaceURI();
}
代码示例来源:origin: org.xml-cml/cmlxom
/** recursively delete all non-default and non-cml attributes
* i.e. any attribute with explicit non-cml namespace
* includes cmlx
*
* @param element
*/
public static void removeNonCMLAttributes(CMLElement element) {
List<Attribute> attributes = new ArrayList<Attribute>();
for (int i = 0; i < element.getAttributeCount(); i++) {
Attribute attribute = element.getAttribute(i);
String namespaceURI = attribute.getNamespaceURI();
if (namespaceURI != null
&& !namespaceURI.equals("")
&& !namespaceURI.equals(CMLConstants.CML_NS)) {
attributes.add(attribute);
}
}
for (Attribute attribute : attributes) {
attribute.detach();
}
List<CMLElement> childElementList = element.getChildCMLElements();
for (CMLElement childElement : childElementList) {
removeNonCMLAttributes(childElement);
}
}
public static Document stripDTDAndOtherProblematicXMLHeadings(String s) throws IOException {
代码示例来源:origin: zanata/zanata-platform
private static Map<String, Object> buildMetadata(Element fromElem) {
Map<String, Object> metadata = Maps.newHashMap();
for (int i = 0; i < fromElem.getAttributeCount(); i++) {
Attribute attr = fromElem.getAttribute(i);
String uri = attr.getNamespaceURI();
String name = attr.getLocalName();
if (inTmxNamespace(uri)) {
String value = attr.getValue();
metadata.put(name, value);
} else if (attr.getQualifiedName().equals(XML_LANG)) {
String value = attr.getValue();
metadata.put(attr.getQualifiedName(), value);
}
}
List<String> childrenXml = getChildrenAsXml(fromElem);
metadata.put(TMX_ELEMENT_CHILDREN, childrenXml);
return metadata;
}
代码示例来源:origin: teiid/teiid
private void writeAttribute(Attribute attr) {
writeIndex(attr.getNamespacePrefix(), attr.getLocalName());
int type = ATTRIBUTE;
if (attr.getNamespaceURI().length() == 0) {
type = Util.noNamespace(type);
} else {
writeIndex(attr.getNamespaceURI());
}
writeIndex(attr.getValue());
nodeTokens.add((byte)type);
nodeTokens.add(Util.getAttributeTypeCode(attr));
}
代码示例来源:origin: org.teiid/saxon-xom
private void writeAttribute(Attribute attr) {
writeIndex(attr.getNamespacePrefix(), attr.getLocalName());
int type = ATTRIBUTE;
if (attr.getNamespaceURI().length() == 0) {
type = Util.noNamespace(type);
} else {
writeIndex(attr.getNamespaceURI());
}
writeIndex(attr.getValue());
nodeTokens.add((byte)type);
nodeTokens.add(Util.getAttributeTypeCode(attr));
}
代码示例来源:origin: DSpace/DSpace
protected void processUnexpectedAttributes(Element element, List<SwordValidationInfo> attributeItems) {
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for (int i = 0; i < attributeCount; i++) {
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
info.setContentDescription(attribute.getValue());
attributeItems.add(info);
}
}
代码示例来源:origin: org.dspace/dspace-sword-api
protected void processUnexpectedAttributes(Element element, List<SwordValidationInfo> attributeItems)
{
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for( int i = 0; i < attributeCount; i++ )
{
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
info.setContentDescription(attribute.getValue());
attributeItems.add(info);
}
}
代码示例来源:origin: org.swordapp/sword-common
protected void processUnexpectedAttributes(Element element, ArrayList<SwordValidationInfo> attributeItems)
{
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for( int i = 0; i < attributeCount; i++ )
{
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo info = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
info.setContentDescription(attribute.getValue());
attributeItems.add(info);
}
}
代码示例来源:origin: se.vgregion.pubsubhubbub/pubsubhubbub-hub-composite-pubsub
public DefaultField(Element elm) {
this.name = elm.getLocalName();
this.namespace = elm.getNamespaceURI();
this.prefix = elm.getNamespacePrefix();
for(int i = 0; i<elm.getAttributeCount(); i++) {
Attribute attribute = elm.getAttribute(i);
fields.add(new DefaultField(attribute.getNamespaceURI(), attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getValue()));
}
this.content = XmlUtil.innerToString(elm);
}
代码示例来源:origin: DSpace/DSpace
/**
* This method overrides the XmlElement definition so that it can allow
* the definition of the href attribute. All other attributes are
* shown as 'Unknown Attribute' info elements.
*
* @param element The element that contains the attributes
* @param info The info object that will hold the validation info.
*/
@Override
protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) {
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for (int i = 0; i < attributeCount; i++) {
attribute = element.getAttribute(i);
if (!ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName())) {
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
item.setContentDescription(attribute.getValue());
info.addUnmarshallAttributeInfo(item);
}
}
}
代码示例来源:origin: DSpace/DSpace
/**
* Add the information to the unmarshall attribute section of the specified
* info object.
*
* @param element XML element to process
* @param info validation information item about elements/attributes
*/
protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) {
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for (int i = 0; i < attributeCount; i++) {
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
item.setContentDescription(attribute.getValue());
info.addUnmarshallAttributeInfo(item);
}
}
代码示例来源:origin: org.dspace/dspace-sword-api
/**
* Add the information to the unmarshall attribute section of the specified
* info object.
*
* @param element
* @param info
*/
protected void processUnexpectedAttributes(Element element, SwordValidationInfo info)
{
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for( int i = 0; i < attributeCount; i++ )
{
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
item.setContentDescription(attribute.getValue());
info.addUnmarshallAttributeInfo(item);
}
}
代码示例来源:origin: org.swordapp/sword-common
/**
* Add the information to the unmarshall attribute section of the specified
* info object.
*
* @param element
* @param info
*/
protected void processUnexpectedAttributes(Element element, SwordValidationInfo info)
{
int attributeCount = element.getAttributeCount();
Attribute attribute = null;
for( int i = 0; i < attributeCount; i++ )
{
attribute = element.getAttribute(i);
XmlName attributeName = new XmlName(attribute.getNamespacePrefix(),
attribute.getLocalName(),
attribute.getNamespaceURI());
SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.UNKNOWN_ATTRIBUTE,
SwordValidationInfoType.INFO);
item.setContentDescription(attribute.getValue());
info.addUnmarshallAttributeInfo(item);
}
}
内容来源于网络,如有侵权,请联系作者删除!