To change tag's value to 2 and tag1's value to 3, using XMLStarlet:
xmlstarlet ed \
-u '/root/tag' -v 2 \
-u '/root/tag1' -v 3 \
new.xml
Using your sample input:
xmlstarlet ed \
-u '/root/tag' -v 2 \
-u '/root/tag1' -v 3 \
<<<'12'
...emits as output:
2
3