XmlNode Class Reference

Xml node object. More...

#import <xmlnode.h>

Inheritance diagram for XmlNode:

XmlObject List of all members.

Public Member Functions

(id) - initXmlNode:
 Initialize the instance of XmlNode class.
(xmlNodePtr) - nodePtr
 Get content data.
(xmlElementType) - type
 Get type of source node.
(XmlNodeState- state
 Get state of the node.
(const xmlChar *) - name
 Get name of element node.
(void) - setName:
 Set name of element node.
(id) - setAttr:value:
 Set property to the element node.
(const xmlChar *) - getAttrValue:
 Get attribute value from element node.
(int) - lineNo
 Get line number which contains the node.
(void) - setText:length:
 Set text to text node.
(const xmlChar *) - getText
 Get text from text node.
(BOOL) - isBlankText
 Return true if node is empty text node.
(XmlNode *) - next
 Get next sibling.
(XmlNode *) - next:
 Get next sibling which matches given type.
(XmlNode *) - next:or:
 Get next sibling which matches given types.
(XmlNode *) - parent
 Get parent node.
(XmlNode *) - child
 Get 1st child node.
(XmlNode *) - child:
 Get child which has given type.
(XmlNode *) - child:or:
 Get child node which matches given types.
(XmlNode *) - lastChild
 Get last child node.
(XmlNode *) - lastChild:
 Get last child which has given type.
(XmlNode *) - lastChild:or:
 Get last child node which matches given types.
(id) - addSibling:withFollowers:
 Add node as new sibling.
(id) - addChild:withFollowers:
 Add node as new children.
(id) - duplicate:
 Duplicate the node.
(void) - unlink:
 Unlink the connection of the node.
(void) - replaceBy:
 Replace this node by source node.
(void) - print:
 Print the content of node.

Static Public Member Functions

(id) + newElement:
 Generate new element node.
(id) + newText:
 Generate new text node.

Protected Attributes

xmlNodePtr xml_node_ptr
XmlNodeState node_state

Detailed Description

Xml node object.

Description
Xml node object. It will be an element, attribute and so on.


Member Function Documentation

- (id) addChild: (XmlNode *)  node
withFollowers: (BOOL)  followers
 
 

Add node as new children.

Parameters:
node Source node list to add.
followers If this is true, followers are also added as children.
Description
Add node (and it's followers) as new children. Before adding node, the node is duplicated.

- (id) addSibling: (XmlNode *)  node
withFollowers: (BOOL)  followers
 
 

Add node as new sibling.

Parameters:
node Source node list to add.
followers If this is true, followers are also added as children.
Description
Add node (and it's followers) as new sibling. Before adding node, the node is duplicated.

- (XmlNode *) child  
 

Get 1st child node.

Returns:
1st child or nil if it is not found.
Description
Get 1st child node. If it is not found, nil is returned.

- (XmlNode *) child: (xmlElementType)  type  
 

Get child which has given type.

Returns:
Child node or nil (when it is not found).
Parameters:
type Type of node to search.
Description
Get child which has given type. If it is not found, nil is returned.
Warning:
The blank text node is ignored in this methid.

- (XmlNode *) child: (xmlElementType)  typ1
or: (xmlElementType)  typ2
 
 

Get child node which matches given types.

Returns:
Child node or nil (when it is not found).
Parameters:
typ1 Type to search.
typ2 Other type to search.
Description
Get child node which has given types. If it is not found, nil is returned.
Warning:
The blank text node is ignored in this methid.

- (XmlNode *) duplicate: (BOOL)  withchild  
 

Duplicate the node.

Parameters:
withchild Set true the duplication of children of the node is required.
Description
Duplicate the node. If "withchild" is true, all children also copied.

- (const xmlChar *) getAttrValue: (const xmlChar *)  name  
 

Get attribute value from element node.

Parameters:
name Destination attribute name.
Description
Get attribute value from element node.

- (const xmlChar *) getText  
 

Get text from text node.

Returns:
Content text.
Description
Get content of text node.

- (id) initXmlNode: (xmlNodePtr)  node  
 

Initialize the instance of XmlNode class.

Returns:
Generated instance of XmlNode
Parameters:
node Source xml node.
Description
Initialize the instance of XmlNode class. This method is called by the memory allocation function in libxml2. DO NOT CALL this method directory.

- (BOOL) isBlankText  
 

Return true if node is empty text node.

Returns:
True if the node is empty text node.
Description
Return true when the node is text node and contains only spaces. If the parameter is not text node, this method returns false.

- (XmlNode *) lastChild  
 

Get last child node.

Returns:
Last child or nil if it is not found.
Description
Get last child node. If it is not found, nil is returned.

- (XmlNode *) lastChild: (xmlElementType)  type  
 

Get last child which has given type.

Returns:
Child node or nil (when it is not found).
Parameters:
type Type of node to search.
Description
Get last child which has given type. If it is not found, nil is returned.
Warning:
The blank text node is ignored in this methid.

- (XmlNode *) lastChild: (xmlElementType)  typ1
or: (xmlElementType)  typ2
 
 

Get last child node which matches given types.

Returns:
Child node or nil (when it is not found).
Parameters:
typ1 Type to search.
typ2 Other type to search.
Description
Get last child node which has given types. If it is not found, nil is returned.
Warning:
The blank text node is ignored in this methid.

- (int) lineNo  
 

Get line number which contains the node.

Returns:
If the value is found, return the positive value. But it is not found, returns negative value.
Description
Get line number of the input file which contains the node.

- (const xmlChar *) name  
 

Get name of element node.

Returns:
Name of the element node. If source node is not element node, the result will be null,
Description
Get name of element node. If source node is not element node, the result will be null,

+ (id) newElement: (const xmlChar *)  name  
 

Generate new element node.

Returns:
New element node.
Parameters:
name Name of element node.
Description
Generate new element node.

+ (id) newText: (const xmlChar *)  text  
 

Generate new text node.

Returns:
New text node.
Parameters:
text Content of new text node.
Description
Generate new text node.

- (XmlNode *) next  
 

Get next sibling.

Returns:
Next sibling node or nil (when it is not found).
Description
Get next sibling. If it is not found, nil is returned.

- (XmlNode *) next: (xmlElementType)  type  
 

Get next sibling which matches given type.

Returns:
Next sibling node or nil (when it is not found).
Parameters:
type Type to search.
Description
Get next sibling which has given type. If it is not found, nil is returned.

- (XmlNode *) next: (xmlElementType)  typ1
or: (xmlElementType)  typ2
 
 

Get next sibling which matches given types.

Returns:
Next sibling node or nil (when it is not found).
Parameters:
typ1 Type to search.
typ2 Other type to search.
Description
Get next sibling which has given types. If it is not found, nil is returned.

- (xmlNodePtr) nodePtr  
 

Get content data.

Returns:
xmlNodePtr data.
Description
Get content data. This method is used for XmlDoc class. DO NOT CALL this in the other places.

- (XmlNode *) parent  
 

Get parent node.

Returns:
Parent node or nil (when it is root node).
Description
Get parent node. If it is not found, nil is returned.

- (void) print: (FILE *)  outfp  
 

Print the content of node.

Parameters:
outfp Output file stream.
Returns:
Return nil if execution is failed.
Description
Print the content of node. If some error occured, this method returns nil.

- (void) replaceBy: (XmlNode *)  src  
 

Replace this node by source node.

Parameters:
src Source node.
Description
Replace this node by source node.
Warning:
This node is unlinked after this operation.

- (id) setAttr: (const xmlChar *)  name
value: (const xmlChar *)  value
 
 

Set property to the element node.

Parameters:
name Property name.
value Property value. If you set null. the attribute is removed.
Description
Set property to the element node. If same name property is already exist, the value is overwritten. If value is null, the attribute is removed.

- (void) setName: (const xmlChar *)  name  
 

Set name of element node.

Parameters:
name 
Description
Set name of element node.

- (void) setText: (const xmlChar *)  src
length: (size_t)  len
 
 

Set text to text node.

Parameters:
src Source text.
len Length of the source text.
Description
Overwrite text for text node. Current context will be lose.

- (XmlNodeState) state  
 

Get state of the node.

Returns:
State of the node.
Description
Get state of the node.

- (xmlElementType) type  
 

Get type of source node.

Returns:
Type of source node.
Description
Get type of source node.

- (void) unlink: (BOOL)  withfollowers  
 

Unlink the connection of the node.

Parameters:
withfollowers Set true if you want to unlink all followers of the node.
Description
Unlink the connection of the node.


Member Data Documentation

- (XmlNodeState) node_state [protected]
 

State of the node

- (xmlNodePtr) xml_node_ptr [protected]
 

Content data of XmlNode class


The documentation for this class was generated from the following files:
Generated on Fri Feb 3 01:21:24 2006 for LibXmlKit by  doxygen 1.4.5