Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add prefixes to type attribute in generated xml from netconf
[controller.git]
/
opendaylight
/
netconf
/
netconf-util
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
util
/
xml
/
XmlElement.java
diff --git
a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
index 7cb0bb02859afd89418db41a69c60993671deeeb..212214cd2ab516e8f7c8e1226b63bb16d886e927 100644
(file)
--- a/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
+++ b/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
@@
-103,6
+103,9
@@
public class XmlElement {
}
public String getName() {
}
public String getName() {
+ if (element.getLocalName()!=null && !element.getLocalName().equals("")){
+ return element.getLocalName();
+ }
return element.getTagName();
}
return element.getTagName();
}
@@
-114,6
+117,10
@@
public class XmlElement {
return element.getAttributeNS(namespace, attributeName);
}
return element.getAttributeNS(namespace, attributeName);
}
+ public NodeList getElementsByTagName(String name) {
+ return element.getElementsByTagName(name);
+ }
+
public void appendChild(Element element) {
this.element.appendChild(element);
// Element newElement = (Element) element.cloneNode(true);
public void appendChild(Element element) {
this.element.appendChild(element);
// Element newElement = (Element) element.cloneNode(true);
@@
-273,8
+280,8
@@
public class XmlElement {
public String getNamespaceAttribute() {
String attribute = element.getAttribute(XmlUtil.XMLNS_ATTRIBUTE_KEY);
public String getNamespaceAttribute() {
String attribute = element.getAttribute(XmlUtil.XMLNS_ATTRIBUTE_KEY);
- Preconditions.checkState(attribute != null && !attribute.equals(""), "Element %s must specify
a %s attribut
e",
- toString()
, XmlUtil.XMLNS_ATTRIBUTE_KEY
);
+ Preconditions.checkState(attribute != null && !attribute.equals(""), "Element %s must specify
namespac
e",
+ toString());
return attribute;
}
return attribute;
}
@@
-319,7
+326,7
@@
public class XmlElement {
prefix = "";
}
if (namespaces.containsKey(prefix) == false) {
prefix = "";
}
if (namespaces.containsKey(prefix) == false) {
- throw new IllegalArgumentException("Cannot find namespace for " +
element
+ ". Prefix from content is "
+ throw new IllegalArgumentException("Cannot find namespace for " +
XmlUtil.toString(element)
+ ". Prefix from content is "
+ prefix + ". Found namespaces " + namespaces);
}
return Maps.immutableEntry(prefix, namespaces.get(prefix));
+ prefix + ". Found namespaces " + namespaces);
}
return Maps.immutableEntry(prefix, namespaces.get(prefix));
@@
-369,6
+376,20
@@
public class XmlElement {
return element.hashCode();
}
return element.hashCode();
}
+ public boolean hasNamespace() {
+ try {
+ getNamespaceAttribute();
+ } catch (IllegalStateException e) {
+ try {
+ getNamespace();
+ } catch (IllegalStateException e1) {
+ return false;
+ }
+ return true;
+ }
+ return true;
+ }
+
private static interface ElementFilteringStrategy {
boolean accept(Element e);
}
private static interface ElementFilteringStrategy {
boolean accept(Element e);
}