Objective-C API Library Reference  4.3.0-42-g45f162a
 All Classes Functions Typedefs Properties Pages
Public Functions | Public Static Functions | List of all members
PWXmlElement(PWXmlUtility) Category Reference

Utility class for accessing and manipulating XML.

Public Functions

(BOOL) - childExists:
 
(NSString *) - getOrderedChildName
 
(NSArray *) - getOrderedChildren:
 
(NSString *) - getText:
 
(id) - getTextAs:
 
(id) - getTextAs:childPath:
 
(BOOL) - getTextAsBool
 
(unsigned char) - getTextAsByte
 
(char) - getTextAsChar
 
(NSDate *) - getTextAsDate
 
(NSDecimalNumber *) - getTextAsDecimal
 
(double) - getTextAsDouble
 
(PWGuid *) - getTextAsGuid
 
(short) - getTextAsInt16
 
(int) - getTextAsInt32
 
(long long) - getTextAsInt64
 
(float) - getTextAsSingle
 
(unsigned short) - getTextAsUInt16
 
(unsigned int) - getTextAsUInt32
 
(unsigned long long) - getTextAsUInt64
 
(id) - getTextAsWithChildPathAndDefault:defaultValue:
 
(id) - getTextAsWithDefault:defaultValue:
 
(void) - removeElementWithIndex:
 
(void) - removeElementWithName:
 
(void) - replaceText:
 
(void) - replaceWithTextArray:
 
(void) - replaceWithTextString:
 
(PWXmlParentChild *) - resolveParent:allowCreate:
 
(PWXmlElement *) - resolvePath:
 
(PWXmlElement *) - resolvePath:allowCreate:
 
(PWXmlElement *) - resolvePath:allowCreate:isPathNormalized:
 
(PWXmlElement *) - setText:content:
 
(void) - setTextToBool:
 
(void) - setTextToByte:
 
(void) - setTextToChar:
 
(void) - setTextToDate:
 
(void) - setTextToDecimal:
 
(void) - setTextToDouble:
 
(void) - setTextToGuid:
 
(void) - setTextToInt16:
 
(void) - setTextToInt32:
 
(void) - setTextToInt64:
 
(void) - setTextToSingle:
 
(void) - setTextToUInt16:
 
(void) - setTextToUInt32:
 
(void) - setTextToUInt64:
 

Public Static Functions

(PWXmlElement *) + elementWithName:boolValue:
 
(PWXmlElement *) + elementWithName:byteValue:
 
(PWXmlElement *) + elementWithName:charValue:
 
(PWXmlElement *) + elementWithName:dateValue:
 
(PWXmlElement *) + elementWithName:decimalValue:
 
(PWXmlElement *) + elementWithName:doubleValue:
 
(PWXmlElement *) + elementWithName:guidValue:
 
(PWXmlElement *) + elementWithName:int16Value:
 
(PWXmlElement *) + elementWithName:int32Value:
 
(PWXmlElement *) + elementWithName:int64Value:
 
(PWXmlElement *) + elementWithName:singleValue:
 
(PWXmlElement *) + elementWithName:uInt16Value:
 
(PWXmlElement *) + elementWithName:uInt32Value:
 
(PWXmlElement *) + elementWithName:uInt64Value:
 
(PWXmlElement *) + getSessionElement:sessionId:
 
(PWXmlElement *) + getSessionElement:sessionId:allowCreate:
 
(NSString *) + getSessionElementName:
 
(PWGuid *) + getSessionId:
 
(NSString *) + normalizePath:
 
(PWXmlElement *) + parse:
 
(int) + parseOrdinal:
 
(void) + retainRecursiveWithVersion:version:
 

Methods Descriptions

- (BOOL) childExists: (NSString *)  childName

Check to see if a child exists with specified childName

Parameters
childNamechild's name to search for
Returns
YES if child exists, NO if child does not exist

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
boolValue: (BOOL)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
byteValue: (unsigned char)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
charValue: (char)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
dateValue: (NSDate *)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
decimalValue: (NSDecimalNumber *)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
doubleValue: (double)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
guidValue: (PWGuid *)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
int16Value: (short)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
int32Value: (int)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
int64Value: (long long)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
singleValue: (float)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
uInt16Value: (unsigned short)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
uInt32Value: (unsigned int)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

+ (PWXmlElement*) elementWithName: (NSString *)  name
uInt64Value: (unsigned long long)  value 

Creates an element with the specified name and sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
nameThe name of the element to create.
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (NSString *) getOrderedChildName

Gets the name of the ordered children of the specified element.

Returns
the ordered child name

Extends class PWXmlElement.

- (NSArray *) getOrderedChildren: (NSString *)  orderedName

Gets the ordered children of the specified xml element.

Parameters
orderedNamename of the ordered children
Returns
a NASrray of the ordered children

Extends class PWXmlElement.

+ (PWXmlElement *) getSessionElement: (PWXmlElement *)  root
sessionId: (PWGuid *)  sessionId 

Gets the child element of the root corresponding to the specified session. Will create the node if it does not exist.

Parameters
rootThe root
sessionIdThe session id
Returns
PWXmlElement

Extends class PWXmlElement.

+ (PWXmlElement *) getSessionElement: (PWXmlElement *)  root
sessionId: (PWGuid *)  sessionId
allowCreate: (BOOL)  allowCreate 

Gets the child element of the root corresponding to the specified session. Will create the node if it does not exist.

Parameters
rootThe root
sessionIdThe session id
allowCreateif set to YES then allow create
Returns
PWXmlElement

Extends class PWXmlElement.

+ (NSString *) getSessionElementName: (PWGuid *)  sessionId

Gets the name of a session element with the specified session id.

Parameters
sessionIdThe session id
Returns
a NSString of the element name

Extends class PWXmlElement.

+ (PWGuid *) getSessionId: (NSString *)  elementName

Gets the id of a session element with the specified element name. Expects an element name of the form SessionId-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Parameters
elementNameThe session element name
Returns
PWGuid

Extends class PWXmlElement.

- (NSString *) getText: (NSString *)  childPath

Utility method to get the text from the specified element.

Parameters
childPathpath to retrieve the text from
Returns
the text from the specified element, which may be an empty string

Extends class PWXmlElement.

- (id) getTextAs: (const char *)  objCType

Generic utility method to get the text from the specified element as the specified type.

Parameters
objCTypethe type name
Returns
the XML element converted to an instance of objCType or nil if it could not be converted

Extends class PWXmlElement.

- (id) getTextAs: (const char *)  objCType
childPath: (NSString *)  childPath 

Generic utility method to get the value of the specified child element as the specified type.

Parameters
objCTypethe type name
childPathpath to the child element, relative to the parent
Returns
the text of the child element or nil if the child does not exist

Extends class PWXmlElement.

- (BOOL) getTextAsBool

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (unsigned char) getTextAsByte

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (char) getTextAsChar

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (NSDate *) getTextAsDate

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (NSDecimalNumber *) getTextAsDecimal

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (double) getTextAsDouble

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (PWGuid *) getTextAsGuid

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (short) getTextAsInt16

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (int) getTextAsInt32

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (long long) getTextAsInt64

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (float) getTextAsSingle

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (unsigned short) getTextAsUInt16

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (unsigned int) getTextAsUInt32

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (unsigned long long) getTextAsUInt64

Gets the element value, as the specified type using the appropriate type converter.

Returns
The converted value

Extends class PWXmlElement.

- (id) getTextAsWithChildPathAndDefault: (NSString *)  childPath
defaultValue: (id)  defaultValue 

Generic utility method to get the value of the specified child element.

Parameters
childPathpath to the child element, relative to the parent
defaultValuethe default value to use
Returns
the text of the child element or nil if the child element does not exist

Extends class PWXmlElement.

- (id) getTextAsWithDefault: (const char *)  objCType
defaultValue: (id)  defaultValue 

Generic utility method to get the value of the specified child element as the specified type.

Parameters
objCTypethe type name
defaultValuethe default value to use
Returns
the text of the child element or nil if the child element does not exist

Extends class PWXmlElement.

+ (NSString *) normalizePath: (NSString *)  path

Normalizes an XML path.

Parameters
paththe path to normalize
Returns
the normalized path

Extends class PWXmlElement.

+ (PWXmlElement *) parse: (NSString *)  xmlString

Create a new XElement using an XML string

Parameters
xmlStringXML string to initialize this element with
Returns
XElement

Extends class PWXmlElement.

+ (int) parseOrdinal: (NSString *)  childName

Gets the ordinal from a child name. Returns -1 for all names except those that match the pattern "#integer", in which case the integer value after the octothorpe is returned.

Parameters
childNamename of the child
Returns
the ordinal or -1 if child name did not match the ordinal pattern

Extends class PWXmlElement.

- (void) removeElementWithIndex: (NSInteger)  index

Remove child element at specified index

Parameters
indexindex of child to remove

Extends class PWXmlElement.

- (void) removeElementWithName: (NSString *)  childName

Remove child element that has specified name

Parameters
childNamename of child to remove

Extends class PWXmlElement.

- (void) replaceText: (id)  newText

Utility method to replace the text nodes of an element.

Parameters
newTextobject to replace current text. Valid objects are NSString and NSArray

Extends class PWXmlElement.

- (void) replaceWithTextArray: (NSArray *)  newTextArray

Utility method to replace the text nodes of an element.

Parameters
newTextArraythe new text

Extends class PWXmlElement.

- (void) replaceWithTextString: (NSString *)  newTextString

Utility method to replace the text nodes of an element.

Parameters
newTextStringthe new text

Extends class PWXmlElement.

- (PWXmlParentChild *) resolveParent: (NSString *)  path
allowCreate: (BOOL)  allowCreate 

Resolves the parent and child elements of the specified path in the specified element.

Parameters
paththe path
allowCreateif set to YES then allow create
Returns
a ParentChild containing references to the parent and child

Extends class PWXmlElement.

- (PWXmlElement *) resolvePath: (NSString *)  path

Resolves the path.

Parameters
paththe path
Returns
The child element at the specified path.

Extends class PWXmlElement.

- (PWXmlElement *) resolvePath: (NSString *)  path
allowCreate: (BOOL)  allowCreate 

Resolves the path.

Parameters
paththe path
allowCreateif set to YES to allow creation along the path, otherwise NO
Returns
The child element at the specified path, or nil if it does not exist

Extends class PWXmlElement.

- (PWXmlElement *) resolvePath: (NSString *)  path
allowCreate: (BOOL)  allowCreate
isPathNormalized: (BOOL)  isPathNormalized 

Resolves the path.

Parameters
paththe path
allowCreateif set to YES to allow creation along the path, otherwise NO
isPathNormalizedif set to YES if the path is normalized, otherwise NO
Returns
the child element at the specified path, or null if it does not exist

Extends class PWXmlElement.

+ (void) retainRecursiveWithVersion: (PWXmlElement *)  node
version: (long)  version 

Sets the version and retains all nodes recursively starting at node. This updates all of the nodes including attributes.

Parameters
noderoot node at which to begin operation
versionthe version to set on all of the nodes

Extends class PWXmlElement.

- (PWXmlElement *) setText: (NSString *)  childPath
content: (NSString *)  content 

Sets an element value, creating the element it if it doesn't already exist.

Parameters
childPathpath to the the child element
contentthe child element value
Returns
The child containing the value

Extends class PWXmlElement.

- (void) setTextToBool: (BOOL)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToByte: (unsigned char)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToChar: (char)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToDate: (NSDate *)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToDecimal: (NSDecimalNumber *)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToDouble: (double)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToGuid: (PWGuid *)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToInt16: (short)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToInt32: (int)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToInt64: (long long)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToSingle: (float)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToUInt16: (unsigned short)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToUInt32: (unsigned int)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.

- (void) setTextToUInt64: (unsigned long long)  value

Sets the elements value using the corresponding PWXmlTypeConversion converter.

Parameters
valueThe value to set convert and set the resulting text.

Extends class PWXmlElement.