Methods Summary |
---|
public static void | assertNotRelativeNS(org.w3c.dom.Attr attr)This method throws an exception if the Attribute value contains
a relative URI.
if (attr == null) {
return;
}
String nodeAttrName = attr.getNodeName();
boolean definesDefaultNS = nodeAttrName.equals("xmlns");
boolean definesNonDefaultNS = nodeAttrName.startsWith("xmlns:");
if (definesDefaultNS || definesNonDefaultNS) {
if (namespaceIsRelative(attr)) {
String parentName = attr.getOwnerElement().getTagName();
String attrValue = attr.getValue();
Object exArgs[] = { parentName, nodeAttrName, attrValue };
throw new CanonicalizationException(
"c14n.Canonicalizer.RelativeNamespace", exArgs);
}
}
|
public static void | checkForRelativeNamespace(org.w3c.dom.Element ctxNode)This method throws a CanonicalizationException if the supplied Element
contains any relative namespaces.
if (ctxNode != null) {
NamedNodeMap attributes = ctxNode.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
C14nHelper.assertNotRelativeNS((Attr) attributes.item(i));
}
} else {
throw new CanonicalizationException(
"Called checkForRelativeNamespace() on null");
}
|
public static void | checkTraversability(org.w3c.dom.Document document)This method throws a CanonicalizationException if the supplied Document
is not able to be traversed using a TreeWalker.
if (!document.isSupported("Traversal", "2.0")) {
Object exArgs[] = {
document.getImplementation().getClass().getName() };
throw new CanonicalizationException(
"c14n.Canonicalizer.TraversalNotSupported", exArgs);
}
|
public static boolean | namespaceIsAbsolute(org.w3c.dom.Attr namespace)Method namespaceIsAbsolute
return namespaceIsAbsolute(namespace.getValue());
|
public static boolean | namespaceIsAbsolute(java.lang.String namespaceValue)Method namespaceIsAbsolute
// assume empty namespaces are absolute
if (namespaceValue.length() == 0) {
return true;
}
return namespaceValue.indexOf(':")>0;
|
public static boolean | namespaceIsRelative(org.w3c.dom.Attr namespace)Method namespaceIsRelative
return !namespaceIsAbsolute(namespace);
|
public static boolean | namespaceIsRelative(java.lang.String namespaceValue)Method namespaceIsRelative
return !namespaceIsAbsolute(namespaceValue);
|