[R] XML package help

Skewes,Aaron
Fri, 23 Jan 2009 21:48:02 -0000

Please consider this:

<Manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<!-- eName       : name of the element.
      eValue       : value of the element. -->

        <OutputFilePath>./XYZ</OutputFilePath>
        <FilesList>
                <File>
                        <FileTypeId>10</FileTypeId>
                        <FilePath>./XYZ/</FilePath>
                        <PatientCharacteristics eName="one"
eValue="1"/>
                        <PatientCharacteristics eName="two"
eValue="2"/>
                        <PatientCharacteristics eName="three"
eValue="3"/>
                </File>
</FilesList>
</Manifest>

I am attempting to use XML package and xpathSApply() to extract, say, the eValue
attribute for eName=='0ne' for all <File> nodes that have
<FileTypeId>==10.  I try the following, amoung several things:

doc<-xmlInternalTreeParse(Manifest)
Root = xmlRoot(doc)
xpathSApply(Root,
"//File[FileTypeId=10]/PatientCharacteristics/[@eName='one']",
xmlAttrs)

and it does not work.

Might somebody help me with the syntax here?

Thanks a lot!!
Aaron


	[[alternative HTML version deleted]]