I have a use case in which I need to parse the XML generated by an ArcGIS server, then push that data to another API. The ArcGIS server sits behind the firewall at our customer's site and exposes a REST through which we can query the database. The REST URL looks something like this:


I plan on stepping through the DOM and extract the records in Java (probably using Xerces). All the fields except the geometry fields are pretty straightforward. The geometry fields are defined as type esriFieldTypeGeometry with the data being stored as base64 binary string. My question is: how do I parse the binary data in Java and convert it to a set of coordinates?

Here is an extract of the XML:

<esri:Workspace xmlns:esri='http://www.esri.com/schemas/ArcGIS/10.1'
    <WorkspaceDefinition xsi:type='esri:WorkspaceDefinition'>
    <WorkspaceData xsi:type='esri:WorkspaceData'>
        <DatasetData xsi:type='esri:TableData'>
            <Data xsi:type='esri:RecordSet'>
                <Fields xsi:type='esri:Fields'>
                    <FieldArray xsi:type='esri:ArrayOfField'>
                        <Field xsi:type='esri:Field'>
                            <GeometryDef xsi:type='esri:GeometryDef'>
                                <SpatialReference xsi:type='esri:ProjectedCoordinateSystem'>
                            <ModelName>System-maintained Geometry for a feature</ModelName>
                <Records xsi:type='esri:ArrayOfRecord'>
                    <Record xsi:type='esri:Record'>
                        <Values xsi:type='esri:ArrayOfValue'>
                            <Value xsi:type='esri:PointB'>

Thanks in advance for any suggestions you guys can give.

  • In addition to PointB data, I also have to work with PolylineB and PolygonB data. May 30 '13 at 21:48

My question is: how do I parse the binary data in Java and convert it to a set of coordinates?


URL xmlURL = new URL("http://www.cse.lk/listedcompanies/overview.htm?d-16544-e=3&6578706f7274=1");
InputStream xml = xmlURL.openStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(xml);
  • The question is not about how to parse XML. The question is how to handle the binary base64 coordinate data when parsing the ESRI XML. This is the node in question: <Value xsi:type='esri:PointB'> <Bytes>AQAAAMAnD4uRGzJBAFYObYdpJ0E=</Bytes> </Value> Jun 7 '13 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.