Created
October 13, 2016 15:37
-
-
Save ilake/995ccfacf452ce10984d947c1dcab4ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find node name is gd:email and attribute rel value contains work wording | |
node = doc.xpath("//*[name()='gd:email'][contains(@rel, 'work')]").first | |
# change email address attribute value | |
node.attributes["address"].value = value[:address] | |
# change node content <node>{content is here}</node> | |
node.content = value | |
# remove all nodes that name is gd:phoneNumber | |
doc.xpath("//*[name()='gd:phoneNumber']").remove | |
# add node | |
doc.children.children.last.add_next_sibling( | |
%Q|<gd:phoneNumber #{attr} primary="#{!!phone_value[:primary]}">#{phone_value[:number]}</gd:phoneNumber>| | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment