org.codeforamerica.open311.internals.parsing
Class XMLParser

java.lang.Object
  extended by org.codeforamerica.open311.internals.parsing.AbstractParser
      extended by org.codeforamerica.open311.internals.parsing.XMLParser
All Implemented Interfaces:
DataParser

public class XMLParser
extends AbstractParser

Parses XML files using DOM.

Author:
Santiago MunĂ­n

Field Summary
 
Fields inherited from interface org.codeforamerica.open311.internals.parsing.DataParser
ACCOUNT_ID_TAG, ADDRESS_ID_TAG, ADDRESS_TAG, AGENCY_RESPONSIBLE_TAG, ATTRIBUTE_TAG, ATTRIBUTES_TAG, CHANGESET_TAG, CODE_TAG, CONTACT_TAG, DATATYPE_DESCRIPTION_TAG, DATATYPE_TAG, DESCRIPTION_TAG, DEVICE_ID_TAG, DISCOVERY_TAG, EMAIL_TAG, END_DATE_TAG, ENDPOINT_TAG, ERROR_TAG, EXPECTED_DATETIME_TAG, FIRST_NAME_TAG, FORMAT_TAG, KEY_SERVICE_TAG, KEY_TAG, KEYWORDS_SEPARATOR, KEYWORDS_TAG, LAST_NAME_TAG, LATITUDE_TAG, LONGITUDE_TAG, MEDIA_URL_TAG, METADATA_TAG, NAME_TAG, ORDER_TAG, PHONE_TAG, REQUESTED_DATETIME_TAG, REQUIRED_TAG, SERVICE_CODE_TAG, SERVICE_DEFINITION_TAG, SERVICE_GROUP_TAG, SERVICE_NAME_TAG, SERVICE_NOTICE_TAG, SERVICE_REQUEST_ID_TAG, SERVICE_REQUEST_TAG, SERVICE_REQUESTS_TAG, SERVICE_TAG, SPECIFICATION_TAG, START_DATE_TAG, STATUS_NOTES_TAG, STATUS_TAG, TEXT_FORMAT, TOKEN_TAG, TYPE_TAG, UPDATED_DATETIME_TAG, URL_TAG, VALUE_TAG, VALUES_TAG, VARIABLE_TAG, ZIPCODE_TAG
 
Constructor Summary
XMLParser()
          Creates an instance of an XMLParser creating a DocumentBuilder.
 
Method Summary
 GeoReportV2Error parseGeoReportV2Errors(String rawData)
          Parses an error and returns an object with its information.
 POSTServiceRequestResponse parsePostServiceRequestResponse(String rawData)
          Parses the response of a POST Service Request operation.
 ServiceDefinition parseServiceDefinition(String rawData)
          Parses a service definition.
 ServiceDiscoveryInfo parseServiceDiscovery(String rawData)
          Parses a service discovery and returns an object with its information.
 List<Service> parseServiceList(String rawData)
          Parses the response to the GET service list operation.
 ServiceRequestIdResponse parseServiceRequestIdFromAToken(String rawData)
          Parses the response to the GET service request id from a token.
 List<ServiceRequest> parseServiceRequests(String rawData)
          Parses a list of service requests.
 
Methods inherited from class org.codeforamerica.open311.internals.parsing.AbstractParser
allStringsAreEmpty, buildUrl, checkParameters, getKeywords
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLParser

public XMLParser()
Creates an instance of an XMLParser creating a DocumentBuilder.

Method Detail

parseServiceList

public List<Service> parseServiceList(String rawData)
                               throws DataParsingException
Description copied from interface: DataParser
Parses the response to the GET service list operation.

Parameters:
rawData - Text data.
Returns:
A list of Service objects.
Throws:
DataParsingException

parseServiceDefinition

public ServiceDefinition parseServiceDefinition(String rawData)
                                         throws DataParsingException
Description copied from interface: DataParser
Parses a service definition.

Parameters:
rawData - Text data.
Returns:
A service definition object.
Throws:
DataParsingException - If there was any problem parsing the data.

parseServiceRequestIdFromAToken

public ServiceRequestIdResponse parseServiceRequestIdFromAToken(String rawData)
                                                         throws DataParsingException
Description copied from interface: DataParser
Parses the response to the GET service request id from a token.

Parameters:
rawData - Text data.
Returns:
the given token and the service request id.
Throws:
DataParsingException - If there was any problem parsing the data.

parseServiceRequests

public List<ServiceRequest> parseServiceRequests(String rawData)
                                          throws DataParsingException
Description copied from interface: DataParser
Parses a list of service requests.

Parameters:
rawData - Text data.
Returns:
A list of ServiceRequest objects.
Throws:
DataParsingException - If there was any problem parsing the data.

parsePostServiceRequestResponse

public POSTServiceRequestResponse parsePostServiceRequestResponse(String rawData)
                                                           throws DataParsingException
Description copied from interface: DataParser
Parses the response of a POST Service Request operation.

Parameters:
rawData - Text data.
Returns:
an object containing the response information.
Throws:
DataParsingException - If there was any problem parsing the data.

parseGeoReportV2Errors

public GeoReportV2Error parseGeoReportV2Errors(String rawData)
                                        throws DataParsingException
Description copied from interface: DataParser
Parses an error and returns an object with its information.

Parameters:
rawData - Text data.
Returns:
Error information.
Throws:
DataParsingException - If there was any problem parsing the data.

parseServiceDiscovery

public ServiceDiscoveryInfo parseServiceDiscovery(String rawData)
                                           throws DataParsingException
Description copied from interface: DataParser
Parses a service discovery and returns an object with its information.

Parameters:
rawData - Text data.
Returns:
Service discovery information (endpoints and their formats).
Throws:
DataParsingException - If there was any problem parsing the data.


Copyright © 2013 Code for America. All Rights Reserved.