d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Change One Element In Xml File > File Reader/writer Vs Dom Vs Sax Vs Stax
Prev12
Add Reply New Topic New Poll
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Feb 25 2015 05:34pm
Quote (AbDuCt @ Feb 25 2015 06:27pm)
One node spanning multiple lines though.


<ns1:Password>hunter2</ns1:Password>

is the node in question, and it is only one line. The SOAP message was merely an example of a time where using regex to change the value of a single node in an XDoc is not pretty.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Feb 25 2015 06:47pm
Quote (Minkomonster @ Feb 25 2015 07:34pm)
<ns1:Password>hunter2</ns1:Password>

is the node in question, and it is only one line. The SOAP message was merely an example of a time where using regex to change the value of a single node in an XDoc is not pretty.


Of course. But the soap was multiple lines :3
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Feb 25 2015 07:06pm
The rest of it was to give context. It isn't like his XML doc is just <Node>Value</Node>. There is more to it.
Member
Posts: 11,637
Joined: Feb 2 2004
Gold: 434.84
Feb 26 2015 02:53pm
Quote (AbDuCt @ Feb 24 2015 06:57pm)
If you only need one line changed and you know the exact line, just use regex.

Don't need to parse shit.


Regex is for parsing regular languages (http://en.wikipedia.org/wiki/Regular_language). XML is not a regular language. Using the right tool for the job makes life a lot easier than hacking something together that works sometimes.
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll