Examples

Provides example snippets to understand the use of SDMParser APIs.

Example of parsing a feed or single entry

   try {
	//Parsing a feed or a single entry.
	//Assuming that schema and service document already parsed 
	//and collection selected
	List<ISDMODataEntry> entries =
		parser.parseODataEntriesXML(responseXML,collectionId,schema);
	//Assuming there is at least one entry in the feed.
	ISDMODataEntry entry = entries.get(0);
	//Retrieving the valid property meta data from the given SDMOdataSchema.
	List<ISDMODataProperty> properties = entry.getPropertiesData();
	//Assuming there is at least one property for the entry.
	ISDMODataProperty property = properties.get(0);
	boolean visibleInList = property.getAttribute("visible-in-list");
	String value;
	if (visibleInList) {
		value = property.getValue();
	} else {
		value = "invisible";
	}
   } catch(SDMParserException e) {}

ETag Support

private SDMODataEntry entryDoc;  //entryDoc corresponds to the XML document with entries
String eTag = entryDoc.getEtag();  //Passes a null value if the document does not contain an ETag.