|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.geodatabase.XmlPropertySet
public class XmlPropertySet
Esri XML PropertySet object.
Creating a new XmlPropertySet
When a new XmlPropertySet is created, it contains no XML header or document elements. Attempting to use a newly-created XmlPropertySet in almost any way will raise an error until the header and root element are added. There are three ways to do this:
Using the IPropertySet interface on an XmlPropertySet
Accessing an instance of the XmlPropertySet class through the IPropertySet interface varies slightly from the interface's typical use. In a typical property set, there is a 1:1 relationship between properties and values, but because metadata can contain multiple occurrences of a property, the relationship between properties and values in an XmlPropertySet is 1:N. This has an effect on the types of objects returned through the outbound parameters of methods such as GetProperty and GetProperties. The following paragraphs describe the differences in the behavior of each member between a typical property set and an XmlPropertySet containing metadata.
One note that applies to all "getter" methods on this interface is that binary enclosures of type Picture will not be returned as text values, but as IPicture references. Binary enclosures of type Image or Base64 will be extracted to the current user's temporary directory, and a path to the temporary file will be the property's value.
Count: In a typical property set, this returns the total number of properties. When called on an XmlPropertySet, it returns the number of top-level elements. In a metadata document, this will always be one, the Metadata element.
GetAllProperties: An XmlPropertySet's implementation of this method behaves similar to that of a regular property set. Each leaf node is returned as an element in the returned arrays, with the array of names containing the semi-qualified name of each property ("/Metadata" is omitted).
GetProperties: In a typical property set, an array containing strings is provided to this method, and the variant passed to the values parameter is populated with the corresponding values, as strings. Due to the 1:N relationship between properties and values in an XmlPropertySet, however, the values variant does not return an array of strings, but rather a jagged two-dimensional array (an array of arrays) that contain strings. For example, if an array containing a single string, "idinfo/keywords/theme/themekey", was passed to this method, the outbound values parameter would contain an array with a single element, an array of strings. That array would (for many datasets) contain several strings. See this coclass' associated code for a concrete example of this.
Although the names parameter of this method accepts a variant, it must actually be an array of strings (not a variant containing strings), or an error will occur.
This method accepts XSL patterns as valid input strings. If a provided XSL pattern matches multiple properties, the values of these properties will all be returned within a single array in the outbound values parameter. For example, passing an array with the string "*" into the names parameter would return an array with a single "inner" array, with the inner array would contain all top-level elements. See this coclass' associated code for a concrete example of this.
GetProperty: As with GetProperties, the 1:N relationship between properties and values has an effect on the outbound variant parameter of this method. Rather than returning a string, as is the case with typical property sets, an array of strings is returned (one string for each matching property). Also similar to GetProperties, an XSL pattern can be provided as name parameter, with all of the matching properties' values being returned in the values array.
IsEqual: Normally used to compare property sets, this method will always return false when called on an XmlPropertySet, regardless of whether or not the property sets being compared are equal.
RemoveProperty: This method accepts XSL patterns as valid input, meaning that multiple properties can be deleted with a single call. If deleting a single instance of a property (where there are multiple occurrences) is intended, a value or attribute filter can be applied to the property's name, or an indexer may be used. If the specified property is a node containing other properties, all of the sub-nodes will also be removed.
SetProperties: This method accepts a string array (containing property names or XSL patterns) and a variant containing strings, which are the values the properties (or all properties matching the provided pattern) should be set to. Unlike GetProperties, which retrieves a jagged two-dimensional array of strings as its values parameter, this method must be given a simple array of strings, and any specified properties or patterns with multiple occurrences are assigned the same value.
SetProperty: Calling this method on an XmlPropertySet is equivalent to calling IXmlPropertySet.SetPropertyX, with the propType parameter set to esriXPTText, the action parameter set to esriXSPAAddOrReplace, and the syncing parameter set to False. For more information, see the IXmlPropertySet.SetPropertyX documentation.
Constructor Summary | |
---|---|
XmlPropertySet()
Constructs a XmlPropertySet using ArcGIS Engine. |
|
XmlPropertySet(Object obj)
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts. XmlPropertySet theXmlPropertySet = (XmlPropertySet) obj; |
Method Summary | |
---|---|
void |
assign(IClone src)
Assigns the properties of src to the receiver. |
void |
deleteProperty(String name)
Deletes the specified elements. |
void |
deletePropertyByAttribute(String attribute,
String value,
boolean deleteParent)
Deletes the elements which have the specified attribute value. |
void |
deletePropertyByNameAndAttribute(String name,
String attribute,
String value,
boolean deleteParent)
Deletes the specified elements which have the specified attribute value. |
void |
deserialize(IXMLSerializeData data)
Deserializes an object from XML. |
boolean |
equals(Object o)
Compare this object with another |
IClone |
esri_clone()
Clones the receiver and assigns the result to *clone. |
void |
getAllProperties(Object[] names,
Object[] values)
The name and value of all the properties in the property set. |
void |
getAttribute(String name,
String attribute,
Object[] value)
Returns the set of values for the specified attribute from the specified elements. |
void |
getClassID(GUID[] pClassID)
getClassID |
static String |
getClsid()
getClsid. |
int |
getCount()
The number of properties contained in the property set. |
int |
getCountX(String name)
Number of occurrances of an element in the metadata. |
void |
getProperties(Object names,
Object[] values)
The values of the specified properties. |
void |
getPropertiesByAttribute(String attribute,
String value,
boolean noValues,
Object[] tags,
Object[] values)
Returns the set of names and values for elements which have the specified attribute value. |
Object |
getProperty(String name)
The value of the specified property. |
void |
getSizeMax(_ULARGE_INTEGER[] pCbSize)
getSizeMax |
String |
getXml(String name)
Returns the XML corresponding to the specified element as a string. |
int |
hashCode()
the hashcode for this object |
void |
initExisting()
Initializes an XmlPropertySet and adds the Esri group of elements. |
void |
initGeneric(String rootName)
Initializes an XmlPropertySet without adding the Esri group of elements. |
void |
initNew()
initNew |
void |
interfaceSupportsErrorInfo(GUID riid)
interfaceSupportsErrorInfo |
void |
isDirty()
isDirty |
boolean |
isEqual(IClone other)
Indicates if the receiver and other have the same properties. |
boolean |
isEqual(IPropertySet propertySet)
True if the property set is the same as the input property set. |
boolean |
isIdentical(IClone other)
Indicates if the receiver and other are the same object. |
boolean |
isNew()
Indicates if a new XmlPropertySet was created on retrieving the metadata. |
boolean |
isOverwriteSyncAttribute()
Indicates if the Sync attribute will be ignored when setting an element's value. |
void |
load(IStream pStm)
load |
void |
removeProperty(String name)
Removes a property from the set. |
void |
save(IStream pStm,
int fClearDirty)
save |
void |
saveAsFile(String xslPath,
String header,
boolean outputANSI,
String[] outPath)
Transforms the metadata using an XSL stylesheet if specified, writes out the header if specified, and saves it in a file. |
void |
serialize(IXMLSerializeData data)
Serializes an object to XML. |
void |
setAttribute(String name,
String attribute,
Object value,
int action)
Sets the attribute of the specified element. |
void |
setOverwriteSyncAttribute(boolean overwriteSyncAttributes)
Indicates if the Sync attribute will be ignored when setting an element's value. |
void |
setProperties(Object names,
Object values)
The values of the specified properties. |
void |
setProperty(String name,
Object value)
The value of the specified property. |
void |
setPropertyX(String name,
Object value,
int propType,
int action,
boolean syncing)
Sets the value of the specified element. |
void |
setXml(String xml)
Replaces existing metadata with the content defined in the XML. |
String |
simpleGetProperty(String name)
The values of the specified property. |
void |
transformImages(String path,
Object[] fileNames)
Transforms encoded thumbnail and image enclosures to files and links them into the metadata. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef |
---|
getJintegraDispatch, release |
Constructor Detail |
---|
public XmlPropertySet() throws IOException, UnknownHostException
IOException
- if there are interop problems
UnknownHostException
- if there are interop problemspublic XmlPropertySet(Object obj) throws IOException
XmlPropertySet theXmlPropertySet = (XmlPropertySet) obj;
obj
to XmlPropertySet
.
obj
- an object returned from ArcGIS Engine or Server
IOException
- if there are interop problemsMethod Detail |
---|
public static String getClsid()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void isDirty() throws IOException, AutomationException
isDirty
in interface IPersistStreamInit
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void load(IStream pStm) throws IOException, AutomationException
load
in interface IPersistStreamInit
pStm
- A reference to a com.esri.arcgis.system.IStream (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void save(IStream pStm, int fClearDirty) throws IOException, AutomationException
save
in interface IPersistStreamInit
pStm
- A reference to a com.esri.arcgis.system.IStream (in)fClearDirty
- The fClearDirty (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getSizeMax(_ULARGE_INTEGER[] pCbSize) throws IOException, AutomationException
getSizeMax
in interface IPersistStreamInit
pCbSize
- A Structure: com.esri.arcgis.system._ULARGE_INTEGER (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void initNew() throws IOException, AutomationException
initNew
in interface IPersistStreamInit
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getClassID(GUID[] pClassID) throws IOException, AutomationException
IPersist is a Microsoft interface. Please refer to MSDN for information about this interface.
getClassID
in interface IPersist
pClassID
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getCount() throws IOException, AutomationException
The Count value will always be one when used with the esriGeodatabase.XmlPropertySet coclass. For more information, see the remarks for the XmlPropertySet coclass.
getCount
in interface IPropertySet
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.system.IXmlPropertySet
,
com.esri.arcgis.system.IXmlPropertySet2
public Object getProperty(String name) throws IOException, AutomationException
getProperty
in interface IPropertySet
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet.getProperties(java.lang.Object, Object[])
,
IPropertySet.getAllProperties(Object[], Object[])
public void getProperties(Object names, Object[] values) throws IOException, AutomationException
The GetProperties method returns values from a PropertySet CoClass.
getProperties
in interface IPropertySet
names
- A Variant (in)values
- A Variant (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet.getAllProperties(Object[], Object[])
,
IPropertySet.getProperty(String)
public void getAllProperties(Object[] names, Object[] values) throws IOException, AutomationException
The GetAllProperties retrieves all names and values in the property set.
getAllProperties
in interface IPropertySet
names
- A Variant (out: use single element array)values
- A Variant (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet.getProperties(java.lang.Object, Object[])
,
IPropertySet.getProperty(String)
public void setProperty(String name, Object value) throws IOException, AutomationException
The Name parameter uses XSL Patterns to specify metadata elements. Additional information on XSL can be found in the the IXmlPropertySet documentation.
setProperty
in interface IPropertySet
name
- The name (in)value
- A Variant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.system.IXmlPropertySet
,
com.esri.arcgis.system.IXmlPropertySet2
,
IPropertySet.setProperties(java.lang.Object, java.lang.Object)
public void setProperties(Object names, Object values) throws IOException, AutomationException
Using the Name parameter to locate the specified element, the SetProperties method populates the elements, or adds an new element if it already exists, and sets the value to the coorseponding Values parameter.
The Name parameter uses XSL Patterns to specify metadata elements. Additional information on XSL can be found in the the IXmlPropertySet documentation.
esriXmlSetPropertyAction constants are NOT available to handle situations where an element value already exists. Upon encountering elements that already have values, the new values will replace or add values to existing elements. For more control dealing with elements the IXmlPropertySet::SetPropertyX should be used.
In order to populated nodes further along in the Xml tree, nodes necessary to navigate must first be established. For instance in order to populate the "idinfo/ptcontact/cntinfo/cntperp/cntorg" node each subsequent nodes, "idinfo", "idinfo/ptcontact", "idinfo/ptcontact/cntinfo" and "idinfo/ptcontact/cntinfo/cntperp" must already be in place.
setProperties
in interface IPropertySet
names
- A Variant (in)values
- A Variant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPropertySet.setProperty(String, java.lang.Object)
,
com.esri.arcgis.system.IXmlPropertySet
,
This method is not interop compliant and hence unsupported in Java. Use setProperty() instead.
public boolean isEqual(IPropertySet propertySet) throws IOException, AutomationException
This method indicates whether two property sets are equal.
Note that it will always return false if the property set is an esriGeodatabase.XmlPropertySet (for metadata). See the XmlPropertySet coclass' documentation for more information.
isEqual
in interface IPropertySet
propertySet
- A reference to a com.esri.arcgis.system.IPropertySet (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void removeProperty(String name) throws IOException, AutomationException
removeProperty
in interface IPropertySet
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.system.IXmlPropertySet
public int getCountX(String name) throws IOException, AutomationException
getCountX
in interface IXmlPropertySet
getCountX
in interface IXmlPropertySet2
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getPropertiesByAttribute(String attribute, String value, boolean noValues, Object[] tags, Object[] values) throws IOException, AutomationException
The GetPropertiesByAttribute method returns the set of metadata elements where the specific XML attribute has the specified value.
The Attribute parameter specifies the name of the attribute within the Xml metadata element. The Value parameter is the string the attribute is evaluated to or equals. For instance in the example <idinfo/citation/citeinfo/title Sync="TRUE"> the Sync Attribute has a Value of "TRUE".
When used to retrieve a property of type esriXPTBinaryEnclosure or esriXPTImage, the file is extracted from the metadata to a temporary directory and the path of the file is returned as the value. With properties of type esriXPTPicture, the value is an IPicture.
The noValues parameter is currently reserved and has no effect.
getPropertiesByAttribute
in interface IXmlPropertySet
getPropertiesByAttribute
in interface IXmlPropertySet2
attribute
- The attribute (in)value
- The value (in)noValues
- The noValues (in)tags
- A Variant (out: use single element array)values
- A Variant (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.XmlPropertySet.setAttribute(String, String, java.lang.Object, int)
,
The pTags and pValues parameters must be of Objects. pTags returns the Xml metadata tags ("idinfo/citation/citeinfo/title"), while the corresponding pValues returns the value held within the opening and closing tags ("New Title").
public void setPropertyX(String name, Object value, int propType, int action, boolean syncing) throws IOException, AutomationException
The SetPropertyX method uses uses XPath to specify metadata elements. The method then adds or replaces the element value.
The Name parameter uses XPath to specify metadata elements. Additional information on XPath can be found in the IXmlPropertySet documentation. The Value parameter is the property the will be set to.
The propType parameter is a required esriXmlPropertyType constant. By selecting the constant, the type of data stored within the metadata element (normal text, generic binary enclosures, images, links, picture object, binary enclosures containing an image) is set.
The Action parameter is a esriXmlSetPropertyAction constant. These constants allows several options when encountering different scenarios in metadata. The esriXmlSetPropertyAction constants work differently depending on the presence/absence of the XML element. It is important to be familiar with the different actions. For instance, if the Name expression fails to located the specified XML element, all esriXmlSetPropertyAction constants (except esriXSPAReplaceIfExists) will add the XML element. The table below better explains the action constants:
Action Constant | Element Exists | Element Does Not Exist |
---|---|---|
esriXSPAAddOrReplace | Replaces element | Adds a new element |
esriXSPAAddIfNotExists | Nothing happens | Adds a new element |
esriXSPAReplaceIfExists | Replaces element | Nothing happens |
esriXSPAAddDuplicate | Adds an additional element | Adds a new element |
The Boolean syncing parameter provides an additional degree of control when creating or modifying an element. The parameter indicates whether or not synchronization is taking place. The parameter's setting can override the action parameter. When creating a new element, if the parameter is true, the element is given a Sync attribute with a value of "TRUE". When modifying an existing element, if the syncing parameter is false the element is always modified, and if it has a Sync attribute, the attribute is removed. If the syncing parameter is true when modifying an element, the element's Sync attribute is first inspected; if it has a value of "TRUE", modification occurs, but if it has another value (or no Sync attribute) the modification will not occur.
More information can be found in the white paper "Synchronization in ArcCatalog" May. 2001.
setPropertyX
in interface IXmlPropertySet
setPropertyX
in interface IXmlPropertySet2
name
- The name (in)value
- A Variant (in)propType
- A com.esri.arcgis.geodatabase.esriXmlPropertyType constant (in)action
- A com.esri.arcgis.geodatabase.esriXmlSetPropertyAction constant (in)syncing
- The syncing (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.XmlPropertySet.setAttribute(String, String, java.lang.Object, int)
public void deleteProperty(String name) throws IOException, AutomationException
The DeleteProperty method removes the specified XML element(s) within an XML document, including all elements contained by the specified elements.
The Name parameter uses XPath to describe the location and condition of XML nodes in metadata. XPath includes a set of expressions, allowing for more defined queries and filters. More information on XPath can be found in the IXmlPropertySet documentation.
deleteProperty
in interface IXmlPropertySet
deleteProperty
in interface IXmlPropertySet2
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet.setPropertyX(String, java.lang.Object, int, int, boolean)
,
IXmlPropertySet.deletePropertyByAttribute(String, String, boolean)
public void deletePropertyByAttribute(String attribute, String value, boolean deleteParent) throws IOException, AutomationException
If true,the Boolean deleteParent parameter removes of the metadata parent element.
As an example, calling this method on XML similar to that shown below with the parameters "approved", "no", and true would not only delete the "idinfo/timeperd/timeinfo/sngdate/caldate" element, but would also delete the parent "idinfo/timeperd/timeinfo/sngdate" element.
deletePropertyByAttribute
in interface IXmlPropertySet
deletePropertyByAttribute
in interface IXmlPropertySet2
attribute
- The attribute (in)value
- The value (in)deleteParent
- The deleteParent (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet.getPropertiesByAttribute(String, String, boolean, Object[], Object[])
,
IXmlPropertySet.deleteProperty(String)
public String simpleGetProperty(String name) throws IOException, AutomationException
The SimpleGetProperty method returns the value of the specified Name expression as string.
The Name expression uses XPath to locate and process items in XML documents. More information on XPath is available at IXmlPropertySet Interface.
Requesting a property which contains other properties will return the name of one of the child properties.
Using this method to locate Enclosures and Images will extract the files to a temporary directory (if not already extracted) and return the path to the temporary files. Using it to request a property of type Picture will return an IPicture reference.
simpleGetProperty
in interface IXmlPropertySet
simpleGetProperty
in interface IXmlPropertySet2
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet.getPropertiesByAttribute(String, String, boolean, Object[], Object[])
,
IXmlPropertySet.getCountX(String)
public void saveAsFile(String xslPath, String header, boolean outputANSI, String[] outPath) throws IOException, AutomationException
The xslPath parameter is the path of the stylesheet to use when creating output. The stylesheet determines the type of file created by this method (examples are HTML and text files).
If included, the string header is placed before the root object. A placeholder (an empty string) is still necessary even if header is not included.
Unless the boolean parameter outputANSI is true the output file will be Unicode. No differences are found between the two formats for XML, HTML, or Text documents. The outputANSI parameter is used for the FGDC utility MP which only supports ANSI.
The outPath defines the location for the files to be saved. If a file already exists, it is overwritten. A valid outPath string must be specified, otherwise output is not created.
saveAsFile
in interface IXmlPropertySet
saveAsFile
in interface IXmlPropertySet2
xslPath
- The xslPath (in)header
- The header (in)outputANSI
- The outputANSI (in)outPath
- The outPath (in/out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isNew() throws IOException, AutomationException
The IsNew Boolean property reflects the initial state of the XML metadata document when accessed. If no metadata document exists when accessed, a new metadata document is created containing the ESRI defined tags (these are used by ArcCatalog to maintain the metadata document) "ESRI, MetaID, CreaDate, CreaTime, SyncOnce", and the Boolean attribute IsNew is set to "True". If an XML metadata file exists when initially accessed, the Boolean property is False.
Even if the options to automatically create metadata (available though the user interface from the Tools Menu > Option Command > Metadata Tab) have been unchecked, metadata is still created when accessed programmatically.
isNew
in interface IXmlPropertySet
isNew
in interface IXmlPropertySet2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet.initExisting()
public void setAttribute(String name, String attribute, Object value, int action) throws IOException, AutomationException
The SetAttribute method adds or replaces XML attributes and sets the attribute value.
If the Name expression defines repeating elements, the SetAttribute method will change all elements that satisfy the XPath pattern. For instance "idinfo/keywords/theme/themekey" locates all theme keywords. For more information on XPath, see the IXmlPropertySet interface.
The Action parameter is a esriXmlSetPropertyAction constant. These constants allow several options when encountering different scenarios in metadata. Possible scenarios range from metadata elements which already exist and have attribute value to non-existent metadata elements. How to handle the different cases is determined by the Action parameter. The esriXmlSetPropertyAction constants work differently depending on the presence/absence of the XML element as well as the presence/absence of the attribute. It is important to be familiar with the different actions. For instance, if the Name expression fails to located the specified XML element, all esriXmlSetPropertyAction constants, except "Replace If Exist", will Add the XML element, attribute, and attribute value. The table below better explains the action constants:
Action Constant | Element and Attribute Exist | Element exists, Attribute does not | Element does not exist |
---|---|---|---|
esriXSPAAddOrReplace | Replaces attribute value | Adds attribute and value | Adds element, attribute and value |
esriXSPAAddIfNotExists | Nothing happens | Nothing happens | Adds element, attribute and value |
esriXSPAReplaceIfExists | Replaces attribute value | Adds attribute and value | Nothing happens |
esriXSPAAddDuplicate | Adds additional element, attribute and value | Adds additional element, attribute and value | Adds element, attribute and value |
setAttribute
in interface IXmlPropertySet
setAttribute
in interface IXmlPropertySet2
name
- The name (in)attribute
- The attribute (in)value
- A Variant (in)action
- A com.esri.arcgis.geodatabase.esriXmlSetPropertyAction constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet.setPropertyX(String, java.lang.Object, int, int, boolean)
,
IXmlPropertySet.deleteProperty(String)
public void transformImages(String path, Object[] fileNames) throws IOException, AutomationException
Do NOT save metadata after applying the TransformImage method, otherwise the img tags will be saved and the enclosures themselves will be lost. To further explore this, open the metadata file in a Browser that supports XML, an XML editor, or text editor. At the same time look at the file in ArcCatalog with the XML stylesheet. Search for the element Binary, then notice the differences in the documents as they appear in ArcCatalog.
Thumbnails and image enclosures are not stored in the Binary/Thumbnail/Data and Binary/Enclosure/Data elements respectively. TransformImage is used to decode Thumbnails and images and save them to files, then replace the original elements with HTML <img> tags that contain links to those files. For example, ArcCatalog applies this method to the metadata each time it is opened, this lets you see Thumbnails and Image Enclosures in ArcCatalog.
Path names are created using the supplied string, Path. In the example below, Path is set to "c:\temp\", while the file name is "expImg" (an incremental number is added to the file name for each transformation; expImg0, expImg1, expImg2, etc). The appropriate file extension is added. If no Path is supplied, images are written to temp directory location determined by user environment variables.
transformImages
in interface IXmlPropertySet
transformImages
in interface IXmlPropertySet2
path
- The path (in)fileNames
- A Variant (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void initExisting() throws IOException, AutomationException
The InitExisting method can be used to add ESRI elements MetaID, CreaDate, CreaTime, and SyncOnce to existing non-ESRI metadata and XML documents. XML documents created outside ArcCatalog won't ever have these elements, unless you call the InitExisting method.
Upon synchronization, SyncOnce is replaced with SyncDate and SyncTime. Automatic updates and other editing operations in the user interface, or programmatic updates through the IXmlPropertySetEdit::SetProperty, will add ModDate and ModTime.
Anytime ArcGIS creates metadata, automatic or not, theses ESRI elements will be added.
initExisting
in interface IXmlPropertySet
initExisting
in interface IXmlPropertySet2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet
public void initGeneric(String rootName) throws IOException, AutomationException
The InitGeneric method initializes an XmlPropertySet without adding the ESRI group of elements.
This method is available to the XmlProperty CoClass through the IXmlPropertySet2 Interface.
initGeneric
in interface IXmlPropertySet2
rootName
- The rootName (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.initExisting()
public String getXml(String name) throws IOException, AutomationException
The GetXml method returns both the metadata element tag (including attributes/values pairs) and the corresponding value as string.
Specifying an XML element with children nodes will return all children elements and values also.
Because the return variable is of type string, specifying enclosures, images or pictures return the data encoded as Base64 inside of XML tags (unless TransformImages has been called).
If repeating elements are specified, i.e. "idinfo/keywords/theme/themekey", nothing will be returned. More detailed criteria are necessary when specifying the Name parameter. This can be achieved with an XPath query. More information on XPath can be found at the IXmlPropertySet documentation and through documentation below.
getXml
in interface IXmlPropertySet2
name
- The name (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.saveAsFile(String, String, boolean, String[])
,
IXmlPropertySet2.setXml(String)
public void setXml(String xml) throws IOException, AutomationException
The SetXML method replaces the entire metadata document with the Xml string supplied in the XML parameter.
To target specific XML elements, the SetPropertyX method should be used.
setXml
in interface IXmlPropertySet2
xml
- The xml (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.getXml(String)
public void deletePropertyByNameAndAttribute(String name, String attribute, String value, boolean deleteParent) throws IOException, AutomationException
The DeletePropertyByNameAndAttribute method provides additional parameters to delete XML elements and their corresponding values from metadata documents. Similar actions can be accomplished through other methods (DeleteProperty, DeletePropertyByAttribute) and XPath strings. For instance the following lines of pseudocode accomplish the same action;
xmlPropertySet.DeletePropertyByNameAndAttribute("idinfo/keywords/theme/themekey", "new", "yes", False)
xmlPropertySet.DeleteProperty("idinfo/keywords/theme/themekey[@new='yes']")
The Name parameter uses XPath to describe the location and condition of XML nodes in metadata. More information on XPath can be found at the IXmlPropertySet documentation.
If children elements of the specified Name parameter exist, the DeletePropertyByNameAndAttribute method will also remove them from the XML Document.
The Attribute parameter must contain a valid string character. Otherwise the DeleteProperty method should be used for deleting elements without having to specify attributes.
By setting the attribute Value parameter to "", all elements that match the Name and Attribute parameter will be deleted. The DeletePropertyByAttribute method should be used to delete elements without specifying attribute values.
The deleteParent parameter is a Boolean expression that indicates if the parent element of the Name parameter should be deleted. Special attention should be made to this parameter when deleting a Thumbnail or Binary Enclosure. The parent of the Thumbnail element is the Enclosure element, which also happens to be a parent element of the Data element that holds the Binary information. If deleteParent is set to true when specifying the Data or Thumbnail tag, all Enclosures information will be removed.
deletePropertyByNameAndAttribute
in interface IXmlPropertySet2
name
- The name (in)attribute
- The attribute (in)value
- The value (in)deleteParent
- The deleteParent (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.deleteProperty(String)
,
IXmlPropertySet2.deletePropertyByAttribute(String, String, boolean)
public void getAttribute(String name, String attribute, Object[] value) throws IOException, AutomationException
The Name parameter determines the location of the XML element.
Because XML elements may contain multiple attributes/value pairs, the Attribute parameter is used to specify the attribute.
The Value argument is returned containing the attribute values.
The GetAttribute method returns the attribute value of the specified metadata element.
The Name parameter uses XPath to describe the location and condition of XML nodes in metadata. More information on XPath can be found at the IXmlPropertySet documentation.
The Attribute must contain a valid string. If no string is declared (""), a run time error will occur.
getAttribute
in interface IXmlPropertySet2
name
- The name (in)attribute
- The attribute (in)value
- A Variant (out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.The Values parameter must be a Object to hold multiple values.
public void setOverwriteSyncAttribute(boolean overwriteSyncAttributes) throws IOException, AutomationException
setOverwriteSyncAttribute
in interface IXmlPropertySet2
overwriteSyncAttributes
- The overwriteSyncAttributes (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.setPropertyX(String, java.lang.Object, int, int, boolean)
,
IXmlPropertySet2
public boolean isOverwriteSyncAttribute() throws IOException, AutomationException
By default the OverwriteSyncAttribute property is set to false. If the property is changed it remains true for the time the object is held in memory. Once the object is released, the OverwriteSyncAttribute is set back to false.
The OverwriteSyncAttribute property is set for an entire property set and not individual properties.
When the property is set to true, the syncing parameter used and the SetPropertyX methods is ignored. The SetPropertyX action, determined by the esriXmlSetPropertyAction, is then carried out. Otherwise if the OverwriteSyncAttribute property remains false, the esriXmlSetPropertyAction and value of the syncing parameter in the SetPropertyX determine the action.
A complete understanding of the syncing parameter is recommended when setting and getting the OverwriteSyncAttribute property. See the documentation for IXmlPropertySet.SetPropertyX for more information.
isOverwriteSyncAttribute
in interface IXmlPropertySet2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IXmlPropertySet2.setPropertyX(String, java.lang.Object, int, int, boolean)
,
IXmlPropertySet2
public void interfaceSupportsErrorInfo(GUID riid) throws IOException, AutomationException
Indicates whether the interface supports IErrorInfo.
interfaceSupportsErrorInfo
in interface ISupportErrorInfo
riid
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IClone esri_clone() throws IOException, AutomationException
esri_clone
in interface IClone
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void assign(IClone src) throws IOException, AutomationException
assign
in interface IClone
src
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isEqual(IClone other) throws IOException, AutomationException
IsEqual returns True if the receiver and the source have the same properties. Note, this does not imply that the receiver and the source reference the same object.
isEqual
in interface IClone
other
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isIdentical(IClone other) throws IOException, AutomationException
IsIdentical returns true if the receiver and the source reference the same object.
isIdentical
in interface IClone
other
- A reference to a com.esri.arcgis.system.IClone (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void serialize(IXMLSerializeData data) throws IOException, AutomationException
serialize
in interface IXMLSerialize
data
- A reference to a com.esri.arcgis.system.IXMLSerializeData (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void deserialize(IXMLSerializeData data) throws IOException, AutomationException
deserialize
in interface IXMLSerialize
data
- A reference to a com.esri.arcgis.system.IXMLSerializeData (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |