com.sas.metadata.remote
Class XMLUtil

com.sas.metadata.remote.XMLUtil

public class XMLUtil

Contains utility methods for xml processing.

Since:
9.5

Constructor Summary
XMLUtil()
           
 
Method Summary
static java.lang.String createGetMetadataXML(java.util.Map<java.lang.String,java.lang.String> objectMap)
          Creates and returns the XML string used for a GetMetadata request.
static java.lang.String createGetMetadataXML(java.lang.String strType, java.lang.String strFQID, java.util.List<java.lang.String> simpleAttr, java.util.List<java.lang.String> complexAttr)
          Creates and returns the XML string used for a GetMetadata request.
static java.lang.String createObjectAttributeXML(java.util.Map<java.lang.String,java.lang.String> attributes)
          Creates a string of an object's attributes as key/value pairs
static java.lang.String createObjectXML(java.lang.String objectType, java.lang.String objectID, java.util.Map<java.lang.String,java.lang.String> attrs)
          Creates an xml string for the object including all of its simple attributes.
static java.lang.String formatXML(java.lang.String original)
          Format the XML so that we can read it easier.
static java.lang.String normalize(java.lang.String s)
          Converts invalid xml characters, such as "<", ">", "\n", "\t" and others, into acceptable &#xxx entities.
 

Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

formatXML

public static java.lang.String formatXML(java.lang.String original)
Format the XML so that we can read it easier.

Parameters:
original - String
Returns:
String formated original

normalize

public static java.lang.String normalize(java.lang.String s)
Converts invalid xml characters, such as "<", ">", "\n", "\t" and others, into acceptable &#xxx entities.

Parameters:
s - The string to be normalized
Returns:
String The normalized string

createGetMetadataXML

public static java.lang.String createGetMetadataXML(java.lang.String strType,
                                                    java.lang.String strFQID,
                                                    java.util.List<java.lang.String> simpleAttr,
                                                    java.util.List<java.lang.String> complexAttr)
Creates and returns the XML string used for a GetMetadata request.

Parameters:
strType - - XML is generated for this type of metadata object.
strFQID - - Metadata-id, if get is for specific object. May be null or empty.
simpleAttr - - List of simple attributes requested. May be null or empty.
complexAttr - - List of complex attributes requested. May be null or empty.
Returns:
- String object with generated XML.

createGetMetadataXML

public static java.lang.String createGetMetadataXML(java.util.Map<java.lang.String,java.lang.String> objectMap)
Creates and returns the XML string used for a GetMetadata request. This string does not include simple attributes or associations.

Parameters:
objectMap - a map of the objects to retrieve. Keys for the map must be the metadata object ids and the values must be the metadata object type.
Returns:
String object with generated XML.

createObjectXML

public static java.lang.String createObjectXML(java.lang.String objectType,
                                               java.lang.String objectID,
                                               java.util.Map<java.lang.String,java.lang.String> attrs)
Creates an xml string for the object including all of its simple attributes. The format of the returned string is:
   <objectType Attr1="Value" Attr2="Value" ... />
 

Parameters:
objectType - the object's metadata type
objectID - the object id
attrs - map of attribute names and values
Returns:
xml string

createObjectAttributeXML

public static java.lang.String createObjectAttributeXML(java.util.Map<java.lang.String,java.lang.String> attributes)
Creates a string of an object's attributes as key/value pairs

Parameters:
attributes - a map of the object's attributes
Returns:
a String that is the attribues and values formated for XML



Copyright © 2009 SAS Institute Inc. All Rights Reserved.