-
I've deprecated methods and fields that will be removed, would have changed access level, or will have different parameter types. I did that in
4.4.0-SNAPSHOTand not in4.3.0as4.3.0is already released.Changes for now are in branch
xmltools-18for a review. -
Good point about version.
@andrzej.wojcik Are we dropping
Comparatorinterface?@Deprecated @Override public int compareTo(Element elem) { return toStringNoChildren().compareTo(elem.toStringNoChildren()); }Are we dropping
XMLNodeIfcinterface?// Deprecated due to change of parameter type from XMLNodeIfc to Element @Deprecated public void addChild(XMLNodeIfc child) {] -
We are dropping
Compararorespecially as order of attributes is not fixed, so comparison may be returning incorrect values.As for
XMLNodeIfcwe are going to use it internally (seeaddNode()) but I wouldn't expose it if possible. Children as elements asList<Element>is returned bygetChildren()andCDataisCData. I would keep those separate. In this particular case we would be acceptingElementthat implementsXMLNodeIfc, but in my opinionaddChild()should accept onlyElement. -
We are dropping
Compararorespecially as order of attributes is not fixed, so comparison may be returning incorrect values.But attributes are just a
Map<String,String> here? Pondering it - order of children in XML is significant so I don't see much point inComparablehere (?)As for
XMLNodeIfcwe are going to use it internally (seeaddNode()) but I wouldn't expose it if possible. Children as elements asList<Element>is returned bygetChildren()andCDataisCData. I would keep those separate. In this particular case we would be acceptingElementthat implementsXMLNodeIfc, but in my opinionaddChild()should accept onlyElement.+1
From what it looks we need
XMLNodeIfcjust to handle CData?Shouldn't we also deprecate
public void setAttributeStaticStr(String elementPath[], String att_name, String att_value) {}? -
But attributes are just a
Map<String,String>here? Pondering it - order of children in XML is significant so I don't see much point inComparablehere (?)ComparableusedtoStringNoChildren()that means it used just attributes for comparison even without ordering. I do not see how we could implement comparison onElementso it is more reasonable to deprecate and just leave it to the user to implement correct comparator for their use case.From what it looks we need
XMLNodeIfcjust to handleCData?No, we have List as each
Elementmay have subnodes that are eitherCDataorElementand their order mattters, ie.:<x>1<y/>2</x>is different from<x>12<y/></x>so we needCDataandElementin a single list to not lose their order - for that we useXMLNodeIfc. -
But attributes are just a
Map<String,String>here? Pondering it - order of children in XML is significant so I don't see much point inComparablehere (?)ComparableusedtoStringNoChildren()that means it used just attributes for comparison even without ordering. I do not see how we could implement comparison onElementso it is more reasonable to deprecate and just leave it to the user to implement correct comparator for their use case.Makes sense.
From what it looks we need
XMLNodeIfcjust to handleCData?No, we have List as each
Elementmay have subnodes that are eitherCDataorElementand their order mattters, ie.:<x>1<y/>2</x>is different from<x>12<y/></x>so we needCDataandElementin a single list to not lose their order - for that we useXMLNodeIfc.This is what I meant by " just to handle
CData" :)Shouldn't we also deprecate
public void setAttributeStaticStr(String elementPath[], String att_name, String att_value) {}?I was wondering about it, but I think it may be used in many places... but sure we can deprecate it as well.
I'd be in favour of deprecating it. If someone needs to set attribute deep inside element IMHO it's better to get that element via top-level api and then set the value via
setAttribute(key,val). Basically it would result in more explicit code and less ways to do the same thing which would result in cleaner API IMHO.
| Type |
New Feature
|
| Priority |
Normal
|
| Assignee | |
| Version |
4.4.0
|
| Sprints |
n/a
|
| Customer |
n/a
|
-
tigase-server-8.5.0 Open
In #14 we made extensive research into how we want to have
ElementAPI. In order to move forward we should deprecate all members that will be removed when new API from #14 is introduced.