Assuming you're talking about using code to edit your XML file, if you try to avoid the XML parser part you'll only have to reinvent it yourself (poorly, as it's harder than you think to make an XML parser). Don't worry about how much time it takes: That's a premature optimization. Until you know it's too slow, don't worry about it. Also, there are some XML parsers available that are pretty fast, so it shouldn't be an issue anyway.
But that's now why I'm writing. What I really wanted to do was suggest that you change your XML a bit. You're using tags <ip1>, <ip2>, etc., in your <ips> section. You should just use <ip> -- if you want to number them, then give them a number or name attribute like this: <ip id="1"> or have another sub-node to give it a name:
<ips> <ip> <name>foo</name> <from></from> <to></to> </ip> </ips>
There are several problems with dynamically changing your node tags. The most problematic is that any programs processing your XML documents are going to have to have some "magic" to interpret the document because you're trying to make a tag convey two pieces of information: (1) that this is an ip item, and (2) which ip item it is.
...roboticusIn reply to Re: Edit XML File in perl
by roboticus
in thread Edit XML File in perl
by py_201
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |