Menu

#167 Make it easier to extend DomSerializer

v2.19
closed-fixed
nobody
None
5
2017-02-06
2016-01-22
No

In XWiki we need to override DomSerializer. However since it's not coded to be extended we had to copy/paste a lot of code. It was ok so far but since a lot more code was added over the years to DomSerializer (to handle namespaces for example) we have to copy even more code and actually it doesn't even work since DomSerializer is calling non-public code (such as rootNode.getNamespaceURIOnPath(""))...

So we're stuck and need to re-implement getNamespaceURIOnPath() which is a major PITA.

It would be nice if DomSerializer could be more easily extended. I'm proposing to have 2 protected methods in it that would be called from createDOM():
Document createDocument(TagNode rootNode) which would create the Document and set the root element in it.
void createSubnodes(Document document, Element element, List<? extends BaseToken> tagChildren) to populate the passed Document based on the passed parameters.

WDYT?

Thanks

Discussion

  • Scott Wilson

    Scott Wilson - 2016-01-22

    Sounds entirely sensible to me.

    If you supply a patch and tests for this I'd be happy to review and apply them

     
  • Scott Wilson

    Scott Wilson - 2016-08-17
    • Group: v2.16 --> v2.17
     
  • Scott Wilson

    Scott Wilson - 2016-10-19
    • Group: v2.17 --> v2.18
     
  • Scott Wilson

    Scott Wilson - 2017-02-06
    • Group: v2.18 --> v2.19
     
  • Scott Wilson

    Scott Wilson - 2017-02-06

    Done. Will be in release 2.19

     
  • Scott Wilson

    Scott Wilson - 2017-02-06
    • status: open --> closed-fixed
     

Log in to post a comment.