[R] read XML

Martin Morgan mtmorgan at fhcrc.org
Wed Jul 30 14:48:33 CEST 2008


"Paulo Cardoso" <pecardoso at netcabo.pt> writes:

> I have a xml exported by Manifold GIS but I'm not being able to import it
> into R using XLM package.

I can

> library(XML)
> xml <- xmlTreeParse("tmp.xml", useInternal=TRUE)
> xpathApply(xml, "//component/@ymin", xmlValue)
[[1]]
[1] "0.32371064328183174"

[[2]]
[1] "0.32371064328183174"

[[3]]
[1] "0.84662172667648694"

so I wonder what specifically your difficulty is?

Best,

Martin

>
>  
>
> The file have this structure:
>
>  
>
>   <?xml version="1.0" encoding="UTF-8" ?> 
>
> - <layout>
>
>   <name>Layout 2</name> 
>
>   <pagesByX>1</pagesByX> 
>
>   <pagesByY>1</pagesByY> 
>
> - <elements>
>
>   <legend refParent="r3" xmax="0.54156171284634758"
> xmin="0.020151133501259435" ymax="0.31480598161051165"
> ymin="0.042461931948864044" /> 
>
>   <component background="auto" border="none" borderDegMinSec="false"
> borderEachPage="true" borderFont="Tahoma, 8" borderFore="#000000"
> borderMargin="12" borderNoOverlaps="true" borderRounding="0" borderStep="1"
> borderUnit="Meter" controlPoints="auto" graticule="auto" grid="auto"
> legend="auto" name="MapMnaziBayhab" northArrow="auto" paging="continuous"
> ref="r1" scaleBar="auto" scope="locked center / scale"
> scopeDetail="646802.61034615175,8856311.5759953968,150"
> xmax="0.35877862595419846" xmin="0.027989821882951665"
> ymax="0.98902384414662947" ymin="0.32371064328183174" /> 
>
>   <component background="auto" border="none" borderDegMinSec="false"
> borderEachPage="true" borderFont="Tahoma, 8" borderFore="#000000"
> borderMargin="12" borderNoOverlaps="true" borderRounding="0" borderStep="1"
> borderUnit="Meter" controlPoints="auto" graticule="auto" grid="auto"
> legend="hide" name="MapMnaziBayall" northArrow="auto" paging="continuous"
> ref="r3" scaleBar="auto" scope="locked center / scale"
> scopeDetail="646802.61034615175,8856311.5759953968,150"
> xmax="0.707379134860051" xmin="0.37659033078880411"
> ymax="0.98902384414662947" ymin="0.32371064328183174" /> 
>
>   <component background="auto" border="none" borderDegMinSec="false"
> borderEachPage="true" borderFont="Tahoma, 8" borderFore="#000000"
> borderMargin="12" borderNoOverlaps="true" borderRounding="0" borderStep="1"
> borderUnit="Degree" controlPoints="auto" graticule="auto" grid="auto"
> legend="auto" name="Map Africa Mnazi" northArrow="auto" paging="continuous"
> ref="r6" scaleBar="auto" scope="entire component" xmax="0.93198992443324935"
> xmin="0.73047858942065491" ymax="0.98902384414662947"
> ymin="0.84662172667648694" /> 
>
>   </elements>
>
>   </layout>
>
>  
>
> Any idea?
>
>  
>
> Thanks.
>
>  
>
> Paulo Cardoso
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the R-help mailing list