The value of attribute "id" should be modified from "moduleCoreId" to "123".
val testXml = loadXml(new FileReader("org.eclipse.wst.common.component"))
//> testXml : scales.xml.Doc = scales.xml.doc
val root = top(testXml).*("project-modules"l) //> root : scales.xml.XPath[List[scales.utils.Path[scales.xml.XmlItem,scales.xm
//| l.Elem,[T]scales.utils.ImmutableArrayProxy[T]]]] = scales.xml.XPath@2a8ceeea
//|
val idAtribPath = top(testXml).*("project-modules"l)\@("id"l)
//> idAtribPath : scales.xml.AttributePaths[List[scales.utils.Path[scales.xml.X
//| mlItem,scales.xml.Elem,[T]scales.utils.ImmutableArrayProxy[T]]]] = Attribute
//| Paths(List(AttributePath(Attribute({}id,moduleCoreId),Path(Top,0,scales.xml.
//| Elem$NoNamespacesElem@e92d9317))),XPathInfo(List(List(Path(Top,0,scales.xml.
//| Elem$NoNamespacesElem@e92d9317))),false,false,false,true,false),scala.collec
//| tion.generic.GenTraversableFactory$ReusableCBF@1b31303f)
string(idAtribPath) //> res0: String = moduleCoreId
val folded= foldPositions( root){
p => {
Replace(elem(p)/@("id" ->"123"))
//AsIs()
}
} //> folded : Paths.this.FoldR[scales.xml.XmlItem,scales.xml.Elem,scales.xml.XCC
//| ] = Right(AddedBeforeOrAfterRoot)
printTree(folded.left.get.tree)