Seems like LibExpat or Requests has some kind of OS-dependent behavior that’s utterly breaking my XML parsing. An example follows; works in Windows, pukes in Linux. Could someone please tell me what can be done to parse such an XML file in an OS-independent way? Could someone please explain what the problem is that’s causing this OS-dependent behavior?
Thank you.
MWE
using Requests
using LibExpat
url = "http://service.iris.edu/fdsnws/event/1/query?starttime=2011-03-11T05:37:00&endtime=2011-03-11T05:57:00&minmag=7.0&maxmag=9.9&format=xml"
R = get(url)
xstr = String(IOBuffer(R.data))
tmp = LibExpat.xp_parse(xstr)
LINUX RESULTS (Ubuntu 16.04, Julia 0.5.0)
ERROR: "BoundsError(Union{AbstractString,LibExpat.ETree}[],(1,)), , 0, 0, 0" in xp_parse(::String) at /home/josh/.julia/v0.5/LibExpat/src/LibExpat.jl:276
WINDOWS RESULTS (Windows 10, Julia 0.5.0)
<q:quakeml xmlns:q="http://quakeml.org/xmlns/quakeml/1.2" xmlns:catalog="http://anss.org/xmlns/catalog/0.1" xmlns="http://quakeml.org/xmlns/bed/1.2">
<eventParameters publicID="quakeml:nc.anss.org/Event/NC/71541116#148486928789">
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2017-01-19T23:41:27.89</creationTime>
</creationInfo>
<event catalog:eventid="71541116" catalog:datasource="nc" publicID="quakeml:nc.anss.org/Event/NC/71541116" catalog:eventsource="nc" catalog:dataid="nc71541116">
<preferredOriginID>quakeml:nc.anss.org/Origin/NC/7205099</preferredOriginID>
<preferredMagnitudeID>quakeml:nc.anss.org/Netmag/NC/4276694</preferredMagnitudeID>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-11T18:04:37.00</creationTime>
<version>4</version>
</creationInfo>
<type>earthquake</type>
<origin catalog:eventid="71541116" catalog:datasource="nc" publicID="quakeml:nc.anss.org/Origin/NC/7205099" catalog:eventsource="nc" catalog:dataid="nc71541116">
<time>
<value>2011-03-11T04:51:24.93</value>
</time>
<timeFixed>0</timeFixed>
<latitude>
<value>35.3568333</value>
</latitude>
<longitude>
<value>-118.5495</value>
</longitude>
<epicenterFixed>0</epicenterFixed>
<depth>
<value>9314</value>
<uncertainty>810</uncertainty>
</depth>
<depthType>from location</depthType>
<type>hypocenter</type>
<evaluationMode>manual</evaluationMode>
<evaluationStatus>final</evaluationStatus>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-11T18:04:34.00</creationTime>
</creationInfo>
<originUncertainty>
<confidenceEllipsoid>
<semiMajorAxisLength>1944</semiMajorAxisLength>
<semiMinorAxisLength>504</semiMinorAxisLength>
<semiIntermediateAxisLength>984</semiIntermediateAxisLength>
<majorAxisPlunge>89</majorAxisPlunge>
<majorAxisAzimuth>279</majorAxisAzimuth>
<majorAxisRotation>210</majorAxisRotation>
</confidenceEllipsoid>
<preferredDescription>confidence ellipsoid</preferredDescription>
<confidenceLevel>95</confidenceLevel>
<horizontalUncertainty>410</horizontalUncertainty>
</originUncertainty>
<methodID>smi:nc.anss.org/origin/HYP2000_m2g</methodID>
</origin>
<magnitude publicID="quakeml:nc.anss.org/Netmag/NC/4276694">
<mag>
<value>3.36</value>
<uncertainty>.115</uncertainty>
</mag>
<type>Ml</type>
<originID>quakeml:nc.anss.org/Origin/NC/7205099</originID>
<stationCount>32</stationCount>
<azimuthalGap>80.9</azimuthalGap>
<evaluationMode>manual</evaluationMode>
<evaluationStatus>reviewed</evaluationStatus>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-11T18:04:37.00</creationTime>
</creationInfo>
<methodID>smi:nc.anss.org/magnitude/CISNml2</methodID>
</magnitude>
</event>
<event catalog:eventid="71540846" catalog:datasource="nc" publicID="quakeml:nc.anss.org/Event/NC/71540846" catalog:eventsource="nc" catalog:dataid="nc71540846">
<preferredOriginID>quakeml:nc.anss.org/Origin/NC/7205529</preferredOriginID>
<preferredMagnitudeID>quakeml:nc.anss.org/Netmag/NC/4277044</preferredMagnitudeID>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-12T01:03:14.00</creationTime>
<version>3</version>
</creationInfo>
<type>earthquake</type>
<origin catalog:eventid="71540846" catalog:datasource="nc" publicID="quakeml:nc.anss.org/Origin/NC/7205529" catalog:eventsource="nc" catalog:dataid="nc71540846">
<time>
<value>2011-03-10T15:56:24.75</value>
</time>
<timeFixed>0</timeFixed>
<latitude>
<value>36.0316667</value>
</latitude>
<longitude>
<value>-117.4256667</value>
</longitude>
<epicenterFixed>0</epicenterFixed>
<depth>
<value>5531</value>
<uncertainty>1030</uncertainty>
</depth>
<depthType>from location</depthType>
<type>hypocenter</type>
<evaluationMode>manual</evaluationMode>
<evaluationStatus>final</evaluationStatus>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-12T01:03:14.00</creationTime>
</creationInfo>
<originUncertainty>
<confidenceEllipsoid>
<semiMajorAxisLength>4416</semiMajorAxisLength>
<semiMinorAxisLength>912</semiMinorAxisLength>
<semiIntermediateAxisLength>2688</semiIntermediateAxisLength>
<majorAxisPlunge>34</majorAxisPlunge>
<majorAxisAzimuth>85</majorAxisAzimuth>
<majorAxisRotation>2</majorAxisRotation>
</confidenceEllipsoid>
<preferredDescription>confidence ellipsoid</preferredDescription>
<confidenceLevel>95</confidenceLevel>
<horizontalUncertainty>1530</horizontalUncertainty>
</originUncertainty>
<methodID>smi:nc.anss.org/origin/HYP2000_m2g</methodID>
</origin>
<magnitude publicID="quakeml:nc.anss.org/Netmag/NC/4277044">
<mag>
<value>3.08</value>
<uncertainty>.152</uncertainty>
</mag>
<type>Ml</type>
<originID>quakeml:nc.anss.org/Origin/NC/7205529</originID>
<stationCount>5</stationCount>
<azimuthalGap>175.8</azimuthalGap>
<evaluationMode>manual</evaluationMode>
<evaluationStatus>reviewed</evaluationStatus>
<creationInfo>
<agencyID>NC</agencyID>
<creationTime>2011-03-12T01:03:14.00</creationTime>
</creationInfo>
<methodID>smi:nc.anss.org/magnitude/CISNml2</methodID>
</magnitude>
</event>
</eventParameters>
</q:quakeml>