EzXML.jl icon indicating copy to clipboard operation
EzXML.jl copied to clipboard

API changes towards EzXML.jl 1.0 on Julia 1.0.

Open bicycle1885 opened this issue 6 years ago • 7 comments

Some of these changes will need features introduced in Julia 1.0.

Properties

  • Add node properties: type, path, name, content, namespace (#54).
  • Add document properties: root, dtd (#54).
  • Add tree traversal properties: document, parentnode, firstelement, lastelement, nextelement, prevelement, firstnode, lastnode, nextnode, prevnode (#56).

All these properties return a nothing when it has no corresponding property.

XPath

  • Rename find to findall (#55).
  • Make find* function take an XPath query as the first argument (#55).
  • Make findfirst and findlast return nothing when there is no such node (#57).

This is because the interface of find* has changed in Julia 1.0.

StreamReader

  • ~Introduce the ReaderEvent type.~
  • Add some properties: type, depth, name, content, namespace (#58).
  • ~Add an attribute accessor to ReaderEvent (e.g. event["attr"]).~
  • ~Iterate over reader events; not over ReaderTypes.~

Misc.

  • Update docs.
  • Drop Julia 0.6.
  • Drop Julia 0.7.

bicycle1885 avatar Mar 10 '18 06:03 bicycle1885

Will the accessor functions be deprecated in favor of properties? 😟

ararslan avatar Jul 26 '18 01:07 ararslan

Yes, I plan to do that because properties do not import so many names into the current module. Any objections against it?

bicycle1885 avatar Jul 26 '18 01:07 bicycle1885

Yes, I'm very, very much against that. The names this package uses are unlikely to create any conflict, so I don't see why exporting a lot of things would matter.

ararslan avatar Jul 26 '18 01:07 ararslan

But I think using properties looks nice for accessing some properties (e.g., node name) and offering multiple ways to do the same thing is not elegant. So, I concluded that deprecating accessor functions would be better.

bicycle1885 avatar Jul 26 '18 01:07 bicycle1885

I disagree that it looks at all better; I think it looks much less like Julia and more like Python. Things like primates.firstelement.prevelement were what I was most worried about proliferating once getproperty was introduced.

ararslan avatar Jul 26 '18 01:07 ararslan

I disagree with you. node.firstelement.prevelement looks better than prevelement(firstelement(node)) to me because you don't need to read/write the code from right to left in this case. I think method chaining is not a Julian way but property chaining just looks so good as field chaining as we already do when handling nested structs.

bicycle1885 avatar Jul 26 '18 01:07 bicycle1885

I'll be taking care of some of this in order to get EzXML working on Julia 1.0

omus avatar Aug 09 '18 16:08 omus