TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Karthi Keyan
1k
755
236.9k
want to change xml attribute name.
Apr 6 2017 2:13 AM
Hi, I am having an xml file. I want to change the attribute name of one node.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//NLM//DTD Book DTD v2.3 20070202//EN" "book.dtd">
<book xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="2.3">
<book-meta>
<book-id
pub-id-type
="doi">10.1163/9789004318168</book-id>
<book-title-group>
<book-title>Lay Prophets in Lutheran Europe (<italic>c</italic>. 1550–1700)</book-title>
</book-title-group>
<volume>74</volume>
<series>Brill’s Series in Church History and Religious Culture</series>
<contrib-group>
<contrib contrib-type="author">
<name>
<surname>Beyer</surname>
<given-names>Jürgen</given-names>
</name>
</contrib>
</contrib-group>
<publisher>
<publisher-name>Brill</publisher-name>
<publisher-loc>Leiden</publisher-loc>
</publisher>
<isbn>9789004156289</isbn>
<isbn content-type="e-ISBN">9789004318168</isbn>
<pub-date pub-type="epub"><year>2017</year></pub-date>
<permissions>
<copyright-statement>Copyright 2017 by Koninklijke Brill NV, Leiden, The Netherlands</copyright-statement>
<copyright-year>2017</copyright-year>
<copyright-holder>Koninklijke Brill NV incorporates the imprints Brill, Brill Hes & De Graaf, Brill Nijhoff, Brill Rodopi and Hotei Publishing.</copyright-holder>
</permissions>
</book-meta>
</book>
in this i want to change the pub-id-type into book-id-type. i tried with following code. but i always got null error. what is the problem in that.
doc.XPathSelectElement("//book-meta/book-id").Attribute("pub-id-type").Remove();
doc.XPathSelectElement("//book-meta/book-id").SetAttributeValue("book-id-type", "doi");
Thanks in advance.
Reply
Answers (
2
)
Oledb problem reading large number from excel file
WkhtmltoPdf Page Break Not Working Properly