Skip to content

Add method to make a deep copy of all matches #185

@Nordiii

Description

@Nordiii

My Usecase

I want to modify .fodt Files and replace the placeholders inside the document with values from a Database.
Now I gather multiple matches via the nextUntil(Filter) Method. Currently I need to do something like this to deep copy all elements:

        List<ProjectDTO> projects;
        Match projectMatches = aMatch.nextUntil(filter);
        projects.stream().forEach(project -> {
            List<Element> deepCopies = projectMatches.each()
                    .stream().map(val -> (Element) val.get(0).cloneNode(true))
                    .toList();
            Match copy = $();
            copy = copy.add((deepCopies.toArray(new Element[deepCopies.size()])));
            
            //Do Stuff with the copy
        });

There is Probably a cleaner way, but it would be nice if I could just call projectMatches.deepCopy()

Versions:

  • jOOX:2.0.0
  • Java:17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions