本文整理了Java中nu.xom.Element.getNamespaceDeclarationCount()
方法的一些代码示例,展示了Element.getNamespaceDeclarationCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNamespaceDeclarationCount()
方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:getNamespaceDeclarationCount
暂无
代码示例来源:origin: jaxen/jaxen
public Iterator getNamespaceAxisIterator(Object o)
{
if (! isElement(o)) {
return JaxenConstants.EMPTY_ITERATOR;
}
Map nsMap = new HashMap();
Element elt = (Element)o;
ParentNode parent = elt;
while (parent instanceof Element) {
elt = (Element)parent;
String uri = elt.getNamespaceURI();
String prefix = elt.getNamespacePrefix();
addNamespaceForElement(elt, uri, prefix, nsMap);
int count = elt.getNamespaceDeclarationCount();
for (int i = 0; i < count; i++) {
prefix = elt.getNamespacePrefix(i);
uri = elt.getNamespaceURI(prefix);
addNamespaceForElement(elt, uri, prefix, nsMap);
}
parent = elt.getParent();
}
addNamespaceForElement(elt, "http://www.w3.org/XML/1998/namespace", "xml", nsMap);
return nsMap.values().iterator();
}
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* @param node
* @param count
*/
private static List<String> getNamespaceURIList(Element node) {
List<String> namespaceURIList = new ArrayList<String>();
for (int i = 0; i < node.getNamespaceDeclarationCount(); i++) {
String prefix = node.getNamespacePrefix(i);
String refNamespaceURI = node.getNamespaceURI(prefix);
namespaceURIList.add(refNamespaceURI);
}
return namespaceURIList;
}
代码示例来源:origin: org.concordion/concordion
/**
* If the prefix for the Concordion namespace is something other than "concordion", eg "c", this
* updates the stylesheet to use the prefix.
* This is required since <a href="http://stackoverflow.com/questions/24628932/do-css-namespace-attribute-selectors-work-with-xhtml-html-elements">
* namespaced CSS selectors generally don't work with HTML</a>, so <code>embedded.css</code> uses hardcoded namespace prefixes (eg. <code>[concordion\:example]</code>).
*/
private String updateConcordionNamespacePrefix(Element html, String stylesheetContent) {
for (int i=0; i<html.getNamespaceDeclarationCount(); i++) {
String prefix = html.getNamespacePrefix(i);
if (ConcordionBuilder.NAMESPACE_CONCORDION_2007.equals(html.getNamespaceURI(prefix))) {
return stylesheetContent.replace("concordion\\:", prefix + "\\:");
}
}
return stylesheetContent;
}
}
代码示例来源:origin: concordion/concordion
/**
* If the prefix for the Concordion namespace is something other than "concordion", eg "c", this
* updates the stylesheet to use the prefix.
* This is required since <a href="http://stackoverflow.com/questions/24628932/do-css-namespace-attribute-selectors-work-with-xhtml-html-elements">
* namespaced CSS selectors generally don't work with HTML</a>, so <code>embedded.css</code> uses hardcoded namespace prefixes (eg. <code>[concordion\:example]</code>).
*/
private String updateConcordionNamespacePrefix(Element html, String stylesheetContent) {
for (int i=0; i<html.getNamespaceDeclarationCount(); i++) {
String prefix = html.getNamespacePrefix(i);
if (ConcordionBuilder.NAMESPACE_CONCORDION_2007.equals(html.getNamespaceURI(prefix))) {
return stylesheetContent.replace("concordion\\:", prefix + "\\:");
}
}
return stylesheetContent;
}
}
代码示例来源:origin: org.teiid/saxon-xom
private static Map getNamespacePrefixesInScopeNonPublic(Element element) {
HashMap namespaces = new HashMap();
do {
int size = element.getNamespaceDeclarationCount();
for (int i = 0; i < size; i++) {
String prefix = element.getNamespacePrefix(i);
if (!namespaces.containsKey(prefix)) {
String uri = element.getNamespaceURI(prefix);
namespaces.put(prefix, uri);
}
}
ParentNode parent = element.getParent();
element = (parent instanceof Element ? (Element) parent : null);
} while (element != null);
return namespaces;
}
代码示例来源:origin: teiid/teiid
private static Map getNamespacePrefixesInScopeNonPublic(Element element) {
HashMap namespaces = new HashMap();
do {
int size = element.getNamespaceDeclarationCount();
for (int i = 0; i < size; i++) {
String prefix = element.getNamespacePrefix(i);
if (!namespaces.containsKey(prefix)) {
String uri = element.getNamespaceURI(prefix);
namespaces.put(prefix, uri);
}
}
ParentNode parent = element.getParent();
element = (parent instanceof Element ? (Element) parent : null);
} while (element != null);
return namespaces;
}
代码示例来源:origin: teiid/teiid
private void writeNamespaceDeclarations(Element elem) {
int count = elem.getNamespaceDeclarationCount();
if (count == 1)
return; // elem.getNamespaceURI() has already been written
for (int i = 0; i < count; i++) {
String prefix = elem.getNamespacePrefix(i);
String uri = elem.getNamespaceURI(prefix);
if (prefix.equals(elem.getNamespacePrefix()) && uri.equals(elem.getNamespaceURI())) {
// if (DEBUG) System.err.println("********** NAMESPACE IGNORED ON WRITE ***************\n");
continue;
}
nodeTokens.add((byte)NAMESPACE_DECLARATION);
writeIndex(prefix);
writeIndex(uri);
}
}
代码示例来源:origin: org.teiid/saxon-xom
private void writeNamespaceDeclarations(Element elem) {
int count = elem.getNamespaceDeclarationCount();
if (count == 1)
return; // elem.getNamespaceURI() has already been written
for (int i = 0; i < count; i++) {
String prefix = elem.getNamespacePrefix(i);
String uri = elem.getNamespaceURI(prefix);
if (prefix.equals(elem.getNamespacePrefix()) && uri.equals(elem.getNamespaceURI())) {
// if (DEBUG) System.err.println("********** NAMESPACE IGNORED ON WRITE ***************\n");
continue;
}
nodeTokens.add((byte)NAMESPACE_DECLARATION);
writeIndex(prefix);
writeIndex(uri);
}
}
代码示例来源:origin: teiid/teiid
if (node instanceof Element) {
Element elem = (Element) node;
int size = elem.getNamespaceDeclarationCount();
if (size == 0) {
return NamespaceBinding.EMPTY_ARRAY;
代码示例来源:origin: org.teiid/saxon-xom
if (node instanceof Element) {
Element elem = (Element) node;
int size = elem.getNamespaceDeclarationCount();
if (size == 0) {
return NamespaceBinding.EMPTY_ARRAY;
代码示例来源:origin: org.jboss.teiid/teiid-engine
if (node instanceof Element) {
Element elem = (Element) node;
int size = elem.getNamespaceDeclarationCount();
if (size == 0) {
return NamespaceBinding.EMPTY_ARRAY;
代码示例来源:origin: wiztools/xsd-gen
final boolean hasXmlns = rootElement.getNamespaceDeclarationCount() > 0;
if (hasXmlns || StringUtil.isNotEmpty(nsPrefix)) {
outRoot.addAttribute(new Attribute("targetNamespace", rootElement.getNamespaceURI()));
for (int i = 0; i < rootElement.getNamespaceDeclarationCount(); i++) {
final String nsPrefix2 = rootElement.getNamespacePrefix(i);
final String nsURI = rootElement.getNamespaceURI(nsPrefix2);
内容来源于网络,如有侵权,请联系作者删除!