-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method to make a deep copy of all matches #185
Comments
Another workaround is to just |
Sorry for me beeing unclear! This bit could look like this in the fodt File:
Now I gather all matches via |
Ah, I see. I was thinking of replacing placeholders, not duplicating them. Anyway, this should work? Match d = JOOX.$("""
<a>
<b/>
</a>
""");
d.append(d.find("b").toString());
System.out.println(d); I can see the utility of making this available through API, but in most cases, the string workaround is good enough. |
Copying multiple matches (without inserting them in the existing DOM?) sadly does throw an error:
Error: EDIT: Calling
does not throw an error but is an empty copy. |
But you're not doing what I suggested, you're doing entirely other things. |
My Problem with your example is that you grab a single match and duplicate it.
Sorry for bothering you, the help is much appreciated! |
If you have an "xmlforest", just add a new dummy root node: Match: <a/>
<a/>
<a/> String workaround: <dummy>
<a/>
<a/>
<a/>
</dummy> I mean, it's a workaround. There are other tricks, too. You could also loop over each element in the match using I hope this helps? |
Sorry for the late reply, thank you a lot for the help and time you provided! Thanks to you I was able to archive my goal. |
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:There is Probably a cleaner way, but it would be nice if I could just call
projectMatches.deepCopy()
Versions:
The text was updated successfully, but these errors were encountered: