E
E
Elena2019-09-24 10:53:57
PHP
Elena, 2019-09-24 10:53:57

Replacing a block of tags in a large xml file?

The problem is a file and you need to replace the block in it. The file is big. Google solves the problem by reading the file line by line into a variable, replacing the necessary information and then all this information is immediately written to the file. For a large file, this is not an option. Further, you can still do a byte offset when opening a file. Everything seems to be in order here. But there is a significant minus - the current blocks are being overwritten, and the whole structure is moving. Roughly speaking, it is impossible to overwrite the middle of the file. Maybe with a text file, rewriting one line would work, but it doesn’t work here.
Can you tell me what are the exits?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lazy @BojackHorseman PHP, 2019-09-24
Tag

Simple API for XML

T
ThunderCat, 2019-09-24
@ThunderCat

in order to save memory, you can split the file into n (no, n is not enough, m) files, each of which is processed separately, and then glued together. Otherwise , Lentyuy is right - the tail is still sculpted separately.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question