本文整理了Java中org.w3c.dom.Element.getPrefix()
方法的一些代码示例,展示了Element.getPrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getPrefix()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:getPrefix
暂无
代码示例来源:origin: groovy/groovy-core
protected Map defineNamespaces(Element element, Map namespaces) {
Map answer = null;
String prefix = element.getPrefix();
if (prefix != null && prefix.length() > 0 && !namespaces.containsKey(prefix)) {
answer = new HashMap(namespaces);
defineNamespace(answer, prefix, element.getNamespaceURI());
}
NamedNodeMap attributes = element.getAttributes();
int length = attributes.getLength();
for (int i = 0; i < length; i++) {
Attr attribute = (Attr) attributes.item(i);
prefix = attribute.getPrefix();
if (prefix != null && prefix.length() > 0 && !namespaces.containsKey(prefix)) {
if (answer == null) {
answer = new HashMap(namespaces);
}
defineNamespace(answer, prefix, attribute.getNamespaceURI());
}
}
return (answer != null) ? answer : namespaces;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
String elName = el.getLocalName();
if (el.getNamespaceURI().equals(PackageProperties.NAMESPACE_DCTERMS))
if (!(elName.equals(KEYWORD_CREATED) || elName.equals(KEYWORD_MODIFIED)))
throw new InvalidFormatException(
if (el.getNamespaceURI().equals(PackageProperties.NAMESPACE_DCTERMS)) {
if (!typeAtt.getValue().equals(el.getPrefix() + ":W3CDTF"))
throw new InvalidFormatException("The element '" + elName
+ "' must have the 'xsi:type' attribute with the value '" + el.getPrefix() + ":W3CDTF', but had '" + typeAtt.getValue() + "' !");
代码示例来源:origin: apache/pdfbox
public static boolean isRdfDescription(Element element)
{
return (XmpConstants.DEFAULT_RDF_PREFIX.equals(element.getPrefix()) && XmpConstants.DESCRIPTION_NAME
.equals(element.getLocalName()));
}
代码示例来源:origin: plutext/docx4j
String uri = element.getNamespaceURI() == null? "" : element.getNamespaceURI();
String name = element.getLocalName();
handlePrefixMapping(uri, element.getPrefix());
open = this.efactory.makeOpenElement(uri, name);
代码示例来源:origin: plutext/docx4j
protected void handleParent(Element e, NameSpaceSymbTable ns) {
if (!e.hasAttributes() && e.getNamespaceURI() == null) {
return;
if (e.getNamespaceURI() != null) {
String NName = e.getPrefix();
String NValue = e.getNamespaceURI();
String Name;
if (NName == null || NName.equals("")) {
代码示例来源:origin: org.apache.wink/wink-common
/**
* Returns the name of the element.
*
* @param element the element which name is to be returned
* @return the name of the element
*/
public static String getElementName(Element element) {
if (element.getPrefix() != null && element.getPrefix().length() > 0) {
return element.getPrefix() + ':' + element.getLocalName();
} else {
return element.getLocalName();
}
}
代码示例来源:origin: robovm/robovm
String namespaceURI = ((Element) node).getNamespaceURI();
String prefix = ((Element) node).getPrefix();
String localName = ((Element) node).getLocalName();
代码示例来源:origin: plutext/docx4j
protected void handleParent(Element e, NameSpaceSymbTable ns) {
if (!e.hasAttributes() && e.getNamespaceURI() == null) {
return;
if (e.getNamespaceURI() != null) {
String NName = e.getPrefix();
String NValue = e.getNamespaceURI();
String Name;
if (NName == null || NName.equals("")) {
代码示例来源:origin: com.github.lafa.pdfbox/xmpbox
public static boolean isRdfDescription(Element element)
{
return (XmpConstants.DEFAULT_RDF_PREFIX.equals(element.getPrefix()) && XmpConstants.DESCRIPTION_NAME
.equals(element.getLocalName()));
}
代码示例来源:origin: plutext/docx4j
String namespaceURI = ((Element) node).getNamespaceURI();
String prefix = ((Element) node).getPrefix();
String localName = ((Element) node).getLocalName();
代码示例来源:origin: 4thline/cling
if (element.getPrefix() != null && !parentPrefixes.contains(element.getPrefix())) {
thisLevelPrefixes.put(element.getPrefix(), element.getNamespaceURI());
if (attr.getNodeName().startsWith("xmlns")) continue;
if (attr.getPrefix() != null && !parentPrefixes.contains(attr.getPrefix())) {
thisLevelPrefixes.put(attr.getPrefix(), element.getNamespaceURI());
代码示例来源:origin: org.apache.pdfbox/xmpbox
public static boolean isRdfDescription(Element element)
{
return (XmpConstants.DEFAULT_RDF_PREFIX.equals(element.getPrefix()) && XmpConstants.DESCRIPTION_NAME
.equals(element.getLocalName()));
}
代码示例来源:origin: apache/pdfbox
public static QName getQName(Element element)
{
return new QName(element.getNamespaceURI(), element.getLocalName(), element.getPrefix());
}
代码示例来源:origin: plutext/docx4j
@Override
protected void handleParent(Element e, NameSpaceSymbTable ns) {
if (!e.hasAttributes() && e.getNamespaceURI() == null) {
return;
if (e.getNamespaceURI() != null) {
String NName = e.getPrefix();
String NValue = e.getNamespaceURI();
String Name;
if (NName == null || NName.equals("")) {
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
protected String getQName(Element elem) throws SAXException {
handlePrefixedAttribute(elem);
String prefix = elem.getPrefix();
if (prefix != null && prefix.length() > 0) {
String qname = prefix + Constants.COLON + elem.getLocalName();
return qname;
} else {
return elem.getLocalName();
}
}
代码示例来源:origin: apache/pdfbox
private void expectNaming(Element element, String ns, String prefix, String ln) throws XmpParsingException
{
if ((ns != null) && !(ns.equals(element.getNamespaceURI())))
{
throw new XmpParsingException(ErrorType.Format, "Expecting namespace '" + ns + "' and found '"
+ element.getNamespaceURI() + "'");
}
else if ((prefix != null) && !(prefix.equals(element.getPrefix())))
{
throw new XmpParsingException(ErrorType.Format, "Expecting prefix '" + prefix + "' and found '"
+ element.getPrefix() + "'");
}
else if ((ln != null) && !(ln.equals(element.getLocalName())))
{
throw new XmpParsingException(ErrorType.Format, "Expecting local name '" + ln + "' and found '"
+ element.getLocalName() + "'");
} // else OK
}
代码示例来源:origin: robovm/robovm
String uri = elem_node.getNamespaceURI();
if (uri != null) {
String prefix = elem_node.getPrefix();
if (prefix==null)
prefix="";
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
protected String getQName(Element elem) throws SAXException {
handlePrefixedAttribute(elem);
String prefix = elem.getPrefix();
if (prefix != null && prefix.length() > 0) {
String qname = prefix + Constants.COLON + elem.getLocalName();
return qname;
} else {
return elem.getLocalName();
}
}
代码示例来源:origin: geotools/geotools
protected void end(Element element, XSDElementDeclaration declaration) throws SAXException {
// push off last context
namespaces.popContext();
String uri = element.getNamespaceURI();
String local = element.getLocalName();
String qName = element.getLocalName();
if ((element.getPrefix() != null) && !"".equals(element.getPrefix())) {
qName = element.getPrefix() + ":" + qName;
} else {
if (forceQualified(declaration)) {
uri = uri != null ? uri : namespaces.getURI("");
if (uri != null) {
qName = namespaces.getPrefix(uri) + ":" + qName;
} else {
uri = "";
}
}
}
serializer.endElement(uri, local, qName);
}
代码示例来源:origin: plutext/docx4j
if (element.getNamespaceURI() != null
&& !(element.getPrefix() == null || element.getPrefix().length() == 0)) {
prefix = element.getPrefix();
} else {
prefix = XMLNS;
内容来源于网络,如有侵权,请联系作者删除!