Package com.sas.metadata.remote
Class XMLUtil
java.lang.Object
com.sas.metadata.remote.XMLUtil
public class XMLUtil
extends Object
Contains utility methods for xml processing.
- Since:
- 9.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateGetMetadataXML(String strType, String strFQID, List<String> simpleAttr, List<String> complexAttr) Creates and returns the XML string used for a GetMetadata request.static StringcreateGetMetadataXML(Map<String, String> objectMap) Creates and returns the XML string used for a GetMetadata request.static StringcreateObjectAttributeXML(Map<String, String> attributes) Creates a string of an object's attributes as key/value pairsstatic StringcreateObjectXML(String objectType, String objectID, Map<String, String> attrs) Creates an xml string for the object including all of its simple attributes.static StringformatXML(String original) Format the XML so that we can read it easier.static Stringnormalize(String s) Converts invalid xml characters, such as "<", ">", "\n", "\t" and others, into acceptable &#xxx entities.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
XMLUtil
public XMLUtil()
-
-
Method Details
-
formatXML
public static String formatXML(String original) Format the XML so that we can read it easier.- Parameters:
original- String- Returns:
- String formated original
-
normalize
public static String normalize(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 String createGetMetadataXML(String strType, String strFQID, List<String> simpleAttr, List<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 String createGetMetadataXML(Map<String, 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 String createObjectXML(String objectType, String objectID, Map<String, 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 typeobjectID- the object idattrs- map of attribute names and values- Returns:
- xml string
-
createObjectAttributeXML
public static String createObjectAttributeXML(Map<String, 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
-