List of usage examples for javax.xml XMLConstants DEFAULT_NS_PREFIX
String DEFAULT_NS_PREFIX
To view the source code for javax.xml XMLConstants DEFAULT_NS_PREFIX.
Click Source Link
From source file:org.xchain.framework.jxpath.JXPathValidator.java
static void validatePrefix(String prefix, NamespaceContext xmlns) { if ((prefix != null) && (!XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) && XMLConstants.NULL_NS_URI.equals(xmlns.getNamespaceURI(prefix))) { throw new JXPathException("The prefix '" + prefix + "' is not defined in the current context."); }/*from www.j a va 2s. c o m*/ }
From source file:org.xchain.framework.util.JXPathContextUtil.java
public static void validate(String value, NamespaceContext namespaceContext) { Matcher matcher = uriLocalNamePattern.matcher(value); if (matcher.matches()) { // this is valid, so return. return;// www . j a v a2 s. c om } matcher = prefixLocalNamePattern.matcher(value); if (matcher.matches()) { String prefix = matcher.group(1); if (prefix != null && !XMLConstants.DEFAULT_NS_PREFIX.equals(prefix) && XMLConstants.NULL_NS_URI.equals(namespaceContext.getNamespaceURI(prefix))) { throw new JXPathException( "There is not namespace mapping for the prefix of qname '" + value + "'."); } return; } matcher = localNamePattern.matcher(value); if (matcher.matches()) { return; } throw new JXPathException("There is a syntax error in the qname '" + value + "'."); }