background image

Taxonomy structure

<< Defining a Taxonomy | Specifying Postal Addresses >>
<< Defining a Taxonomy | Specifying Postal Addresses >>
196
J
AVA
API
FOR
XML R
EGISTRIES
if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
System.out.println("Saved ClassificationScheme");
Collection schemeKeys = br.getCollection();
Iterator keysIter = schemeKeys.iterator();
while (keysIter.hasNext()) {
Key key = (Key) keysIter.next();
System.out.println("The postalScheme key is " +
key.getId());
System.out.println("Use this key as the scheme" +
" uuid in the taxonomy file");
}
}
2. In an XML file, define a taxonomy structure that is compliant with the
JAXR Predefined Concepts DTD. Enter the
ClassificationScheme
ele-
ment in your taxonomy XML file by specifying the returned key ID value
as the
id
attribute and the name as the
name
attribute. For the foregoing
code fragment, for example, the opening tag for the
JAXRClassifica-
tionScheme
element looks something like this (all on one line):
<JAXRClassificationScheme
id="uuid:nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn"
name="MyScheme">
The
ClassificationScheme id
must be a universally unique identifier
(UUID).
3. Enter each
JAXRConcept
element in your taxonomy XML file by specify-
ing the following four attributes, in this order:
a.
id
is the
JAXRClassificationScheme id
value, followed by a
/
sepa-
rator, followed by the code of the
JAXRConcept
element.
b.
name
is the name of the
JAXRConcept
element.
c.
parent
is the immediate parent
id
(either the
ClassificationScheme
id
or that of the parent
JAXRConcept
).
d.
code
is the
JAXRConcept
element code value.
The first
JAXRConcept
element in the
naics.xml
file looks like this (all
on one line):
<JAXRConcept
id="uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2/11"
name="Agriculture, Forestry, Fishing and Hunting"
parent="uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"
code="11"></JAXRConcept>