我怎樣才能在XML替換字符串..XML字符串替換
我
<schema>src/main/castor/document.xsd</schema>
我需要更換到
<schema>cs/src/main/castor/document.xsd</schema>
如果我使用簡單,xmlInStr
是字符串xml文檔格式
xmlInStr.replaceAll(
"src/main/castor/GridDocument.xsd",
"correspondenceCastor/src/main/castor/GridDocument.xsd"
);
我試過替換,
xmlInStr.replace("src/main/castor/GridDocument.xsd".toCharArray().toString(), "correspondenceCastor/src/main/castor/GridDocument.xsd".toCharArray().toString());
它不工作。任何線索
管理這樣
INT INDX = from.indexOf(從); xmlInStr = xmlInStr.substring(0,indx)+ to + xmlInStr.substring(indx + from.length());
你是對的,我錯過了基本! – srinannapa 2010-12-14 09:21:41