Skip Navigation
Genetics Home Reference: your guide to understanding genetic conditions About   Site Map   Contact Us
 
Home A service of the U.S. National Library of Medicine®

Retrieving Search Results in XML

You may obtain search results in XML form by adding the parameter show=xml to the search URL. For example:

http://www.ghr.nlm.nih.gov/search?term=balance&show=xml [Try it]

The search results adhere to the schema below.

Use the count parameter to limit the number of results retrieved. For example, to retrieve only the number of records, but not the records themselves, use count=0:

http://www.ghr.nlm.nih.gov/search?term=balance&show=xml&count=0 [Try it]

Use the start and count parameters together to retrieve the results in chunks. (The index of the first result is 1.)

  1. http://www.ghr.nlm.nih.gov/search?term=balance&show=xml&start=1&count=20 [Try it]
  2. http://www.ghr.nlm.nih.gov/search?term=balance&show=xml&start=21&count=20 [Try it]
  3. etc., until fewer than the requested number of results come back.

If there is an error in the query, the error message is returned in the XML, instead of results.

http://www.ghr.nlm.nih.gov/search?term=cabbage+NOT&show=xml [Try it]

The search results adhere to the following schema.

<xsd:schema>

<!-- Schema for Genetics Home Reference search results -->

<xsd:element name='search_results'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='query' type='xsd:string'/>
   <xsd:choice>
    <xsd:element name='error' type='xsd:string'/>
    <xsd:group ref='results'/>
   </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name='count' type='xsd:integer' use='required'/>
 </xsd:complexType>
</xsd:element>

<xsd:group name='results'>
 <xsd:sequence>
  <xsd:element ref='result' minOccurs='0' maxOccurs='unbounded'/>
 </xsd:sequence>
</xsd:group>

<xsd:element name='result'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='order' type='xsd:integer'/>
   <xsd:element name='score' type='xsd:decimal'/>
   <xsd:element name='url' type='xsd:string'/>
   <xsd:choice>
    <xsd:element ref='condition'/>
    <xsd:element ref='gene'/>
    <xsd:element ref='genefamily'/>
    <xsd:element ref='understand_genetics'/>
    <xsd:element ref='chromosome'/>
    <xsd:element ref='glossary'/>
    <xsd:element ref='picture'/>
   </xsd:choice>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='understand_genetics'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='condition'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='gene'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='symbol' type='xsd:string'/>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='genefamily'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='symbol' type='xsd:string'/>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='chromosome'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='glossary'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='name' type='xsd:string'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

<xsd:element name='picture'>
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name='name' type='xsd:string'/>
   <xsd:element name='slideshow' type='xsd:string' minOccurs='0' maxOccurs='1'/>
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>

</xsd:schema>
 
Published: August 25, 2014