本文整理汇总了Java中org.w3c.dom.Element.getNamespaceURI方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getNamespaceURI方法的具体用法?Java Element.getNamespaceURI怎么用?Java Element.getNamespaceURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Element
的用法示例。
在下文中一共展示了Element.getNamespaceURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQName
import org.w3c.dom.Element; //导入方法依赖的package包/类
private static QName getQName(Element element, POMComponentImpl context) {
String namespace = element.getNamespaceURI();
String prefix = element.getPrefix();
if (namespace == null && context != null) {
namespace = context.lookupNamespaceURI(prefix);
}
String localName = element.getLocalName();
assert(localName != null);
if (namespace == null && prefix == null) {
return new QName(localName);
} else if (namespace != null && prefix == null) {
return new QName(namespace, localName);
} else {
return new QName(namespace, localName, prefix);
}
}
示例2: toQName
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static QName toQName(Element element) {
String namespace = element.getNamespaceURI();
if (namespace == null) {
return new QName(SardineUtil.DEFAULT_NAMESPACE_URI,
element.getLocalName(),
SardineUtil.DEFAULT_NAMESPACE_PREFIX);
} else if (element.getPrefix() == null) {
return new QName(element.getNamespaceURI(),
element.getLocalName());
} else {
return new QName(element.getNamespaceURI(),
element.getLocalName(),
element.getPrefix());
}
}
示例3: addParameters
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Adds the specified parameters to the xsl template as variables within the alfresco namespace.
*
* @param xsltModel
* the variables to place within the xsl template
* @param xslTemplate
* the xsl template
*/
protected void addParameters(final XSLTemplateModel xsltModel, final Document xslTemplate)
{
final Element docEl = xslTemplate.getDocumentElement();
final String XSL_NS = docEl.getNamespaceURI();
final String XSL_NS_PREFIX = docEl.getPrefix();
for (Map.Entry<QName, Object> e : xsltModel.entrySet())
{
if (ROOT_NAMESPACE.equals(e.getKey()))
{
continue;
}
final Element el = xslTemplate.createElementNS(XSL_NS, XSL_NS_PREFIX + ":variable");
el.setAttribute("name", e.getKey().toPrefixString());
final Object o = e.getValue();
if (o instanceof String || o instanceof Number || o instanceof Boolean)
{
el.appendChild(xslTemplate.createTextNode(o.toString()));
// ALF-15413. Add the variables at the end of the list of children
docEl.insertBefore(el, null);
}
}
}
示例4: guaranteeThatElementInCorrectSpace
import org.w3c.dom.Element; //导入方法依赖的package包/类
public void guaranteeThatElementInCorrectSpace(
ElementProxy expected, Element actual
) throws XMLSecurityException {
String expectedLocalname = expected.getBaseLocalName();
String expectedNamespace = expected.getBaseNamespace();
String localnameIS = actual.getLocalName();
String namespaceIS = actual.getNamespaceURI();
if ((expectedNamespace != namespaceIS) ||
!expectedLocalname.equals(localnameIS)) {
Object exArgs[] = { namespaceIS + ":" + localnameIS,
expectedNamespace + ":" + expectedLocalname};
throw new XMLSecurityException("xml.WrongElement", exArgs);
}
}
示例5: validateReference
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Validate the Element referred to by the KeyInfoReference.
*
* @param referentElement
*
* @throws XMLSecurityException
*/
private void validateReference(Element referentElement) throws XMLSecurityException {
if (!XMLUtils.elementIsInSignatureSpace(referentElement, Constants._TAG_KEYINFO)) {
Object exArgs[] = { new QName(referentElement.getNamespaceURI(), referentElement.getLocalName()) };
throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.WrongType", exArgs);
}
KeyInfo referent = new KeyInfo(referentElement, "");
if (referent.containsKeyInfoReference()) {
if (secureValidation) {
throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithSecure");
} else {
// Don't support chains of references at this time. If do support in the future, this is where the code
// would go to validate that don't have a cycle, resulting in an infinite loop. This may be unrealistic
// to implement, and/or very expensive given remote URI references.
throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithoutSecure");
}
}
}
示例6: verifyTagNS
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static void verifyTagNS(Element element, String tag, String nsURI) {
if (!element.getLocalName().equals(tag)
|| (element.getNamespaceURI() != null
&& !element.getNamespaceURI().equals(nsURI)))
fail(
"parsing.invalidTagNS",
new Object[] {
element.getTagName(),
element.getNamespaceURI(),
tag,
nsURI });
}
示例7: namesOfChildren
import org.w3c.dom.Element; //导入方法依赖的package包/类
private static String namesOfChildren(Element e) {
StringBuilder b = new StringBuilder();
for (Element kid : XMLUtil.findSubElements(e)) {
if (b.length() > 0) {
b.append(' ');
}
b.append(kid.getLocalName());
String ns = kid.getNamespaceURI();
b.append(ns.charAt(ns.length() - 1));
}
return b.toString();
}
示例8: getImpliedQName
import org.w3c.dom.Element; //导入方法依赖的package包/类
private static QName getImpliedQName(Element el) {
String ns = el.getNamespaceURI();
if (ns == null) { // this can happen if new element has not added to xdm tree
ns = WSDLQNames.WSDL_NS_URI;
}
return new QName(ns, el.getLocalName());
}
示例9: verifyTagNSRootElement
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static void verifyTagNSRootElement(Element element, QName name) {
if (!element.getLocalName().equals(name.getLocalPart())
|| (element.getNamespaceURI() != null
&& !element.getNamespaceURI().equals(name.getNamespaceURI())))
fail(
"parsing.incorrectRootElement",
new Object[] {
element.getTagName(),
element.getNamespaceURI(),
name.getLocalPart(),
name.getNamespaceURI()});
}
示例10: guaranteeThatElementInCorrectSpace
import org.w3c.dom.Element; //导入方法依赖的package包/类
public void guaranteeThatElementInCorrectSpace(
ElementProxy expected, Element actual
) throws XMLSecurityException {
String expectedLocalname = expected.getBaseLocalName();
String expectedNamespace = expected.getBaseNamespace();
String localnameIS = actual.getLocalName();
String namespaceIS = actual.getNamespaceURI();
if ((!expectedNamespace.equals(namespaceIS)) ||
!expectedLocalname.equals(localnameIS) ) {
Object exArgs[] = { namespaceIS + ":" + localnameIS,
expectedNamespace + ":" + expectedLocalname};
throw new XMLSecurityException("xml.WrongElement", exArgs);
}
}
示例11: getWebdavColType
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* コレクションタイプ文字列を返します.
* @return ColType文字列
* @throws RequestException 例外
*/
public String getWebdavColType() throws RequestException {
Resourcetype rt = this.getResourcetype();
if (rt == null) {
throw new RequestException("resourcetype should be defined in mkcol request, See RFC5689 : extended MKCOL");
}
if (rt.getCollection() == null) {
throw new RequestException("collection should be included in request. See RFC5689 : extended MKCOL");
}
List<Element> el = rt.getAny();
if (el.size() == 0) {
return DavCmp.TYPE_COL_WEBDAV;
}
if (el.size() != 1) {
throw new RequestException(
"only 1 extension to collection specified in RFC5689 is allowed on this server. ");
}
Element e = el.get(0);
String localName = e.getLocalName();
String nsUri = e.getNamespaceURI();
if ("urn:x-personium:xmlns".equals(nsUri)) {
if ("odata".equals(localName)) {
return DavCmp.TYPE_COL_ODATA;
} else if ("service".equals(localName)) {
return DavCmp.TYPE_COL_SVC;
}
throw new RequestException("such DC1 extension not supported on this server");
} else if ("urn:ietf:params:xml:ns:caldav".equals(e.getNamespaceURI())) {
throw new RequestException("such Caldav extension not supported on this server");
}
throw new RequestException("such RFC5689 extension not supported on this server");
}
示例12: parse
import org.w3c.dom.Element; //导入方法依赖的package包/类
public BeanDefinition parse(Element componentsRootElement, ParserContext parserContext) {
// re-initialize defaults
BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
delegate.initDefaults(componentsRootElement);
NodeList nl = componentsRootElement.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
Element ele = (Element) node;
String namespaceUri = ele.getNamespaceURI();
// check beans namespace
if (delegate.isDefaultNamespace(namespaceUri)) {
BeanDefinitionHolder holder = delegate.parseBeanDefinitionElement(ele);
ParsingUtils.decorateAndRegister(ele, holder, parserContext);
}
// handle own components
else if (BlueprintParser.NAMESPACE_URI.equals(namespaceUri)) {
parseTopLevelElement(ele, parserContext);
}
// leave the delegate to find a parser for it
else {
delegate.parseCustomElement(ele);
}
}
}
return null;
}
示例13: createElement
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Create element wrapper for existing DOM element.
*
* @param ownerDocument SOAP document wrapper not null
* @param element DOM element not null
* @return SOAP wrapper for DOM element
*/
public static SOAPElement createElement(SOAPDocumentImpl ownerDocument, Element element) {
Objects.requireNonNull(ownerDocument);
Objects.requireNonNull(element);
String localName = element.getLocalName();
String namespaceUri = element.getNamespaceURI();
String prefix = element.getPrefix();
if ("Envelope".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_2Impl(ownerDocument, element);
}
}
if ("Body".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Body1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Body1_2Impl(ownerDocument, element);
}
}
if ("Header".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Header1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Header1_2Impl(ownerDocument, element);
}
}
if ("Fault".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Fault1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Fault1_2Impl(ownerDocument, element);
}
}
if ("Detail".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Detail1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Detail1_2Impl(ownerDocument, element);
}
}
if ("faultcode".equalsIgnoreCase(localName)
|| "faultstring".equalsIgnoreCase(localName)
|| "faultactor".equalsIgnoreCase(localName)) {
// SOAP 1.2 does not have fault(code/string/actor)
// So there is no else case required
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new FaultElement1_1Impl(ownerDocument,
localName,
prefix);
}
}
return new ElementImpl(ownerDocument, element);
}
示例14: ElementImpl
import org.w3c.dom.Element; //导入方法依赖的package包/类
public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
this.element = domElement;
this.soapDocument = ownerDoc;
this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
soapDocument.register(this);
}
示例15: matches
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public boolean matches(Element element) {
return element.getNamespaceURI() == null;
}