简体   繁体   中英

how to remove namespace prefix with node.js?

I consume a soap webservice.In response , I want to remove namespace prefix from tag elements. How can I do ?

I want to convert as example <common_v26:ActionStatu/> to <ActionStatu/>

You can use a regex replace

var str = "<common_v26:ActionStatus/>"
str = str.replace(/(<\s*)(.+:)/, "$1")  // str is now <ActionStatus/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM