Documentation regeneration and XML parsing fixes/updates.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9698 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-04-25 14:19:57 +00:00
parent dfb5fce3d5
commit 45388db20c
84 changed files with 2028 additions and 1677 deletions

View file

@ -1,3 +1,22 @@
2001-04-25 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/GSXML.h: Many changes to restore encapsulation
of libxml previously broken by someone... Partly as a matter of
good OO programming practice, partly so that the library can be
used effectively from Java (via JIGS).
Moved libxml header includes out of this file.
Removed typedefs for libxml constants and changed 'type' methods
to return 'int'.
Added class methods for mapping between integer type values
and constant string type values.
Added a typeDescription method to GSXMLAttribute for consistency.
* Source/GSXML.m: include required headers and update to implement
changes in API. Also fixed bug in implementation of typeDescription
method for GSXMLNamespace.
* Documentation/gsdoc/GSXMLNode.gsdoc: Updated to reflect current API
* Documentation/gsdoc/GSXMLNamespace.gsdoc: ditto
* Documentation/gsdoc/GSXMLAttribute.gsdoc: ditto
2001-04-25 Nicola Pero <nicola@brainstorm.co.uk> 2001-04-25 Nicola Pero <nicola@brainstorm.co.uk>
* base.make.in: (GNUSTEP_BASE_VERSION), * base.make.in: (GNUSTEP_BASE_VERSION),

View file

@ -28,15 +28,19 @@
</ul> </ul>
<h2>Methods </h2> <h2>Methods </h2>
<ul> <ul>
<li><a href ="GSXMLAttribute.html#method-2">+attributeFrom:</a> <li ><a href ="GSXMLAttribute.html#method-4">+attributeFrom:</a>
<li ><a href ="GSXMLAttribute.html#method-0">+attributeWithNode:name:value:</a> <li ><a href ="GSXMLAttribute.html#method-0">+attributeWithNode:name:value:</a>
<li><a href ="GSXMLAttribute.html#method-3">-initFrom:</a> <li ><a href ="GSXMLAttribute.html#method-1">+descriptionFromType:</a>
<li><a href ="GSXMLAttribute.html#method-1">-initWithNode:name:value:</a> <li ><a href ="GSXMLAttribute.html#method-2">+typeFromDescription:</a>
<li><a href ="GSXMLAttribute.html#method-4">-lib</a> <li ><a href ="GSXMLAttribute.html#method-5">-initFrom:</a>
<li><a href ="GSXMLAttribute.html#method-5">-name</a> <li ><a href ="GSXMLAttribute.html#method-3">-initWithNode:name:value:</a>
<li><a href ="GSXMLAttribute.html#method-7">-next</a> <li ><a href ="GSXMLAttribute.html#method-6">-lib</a>
<li><a href ="GSXMLAttribute.html#method-9">-prev</a> <li ><a href ="GSXMLAttribute.html#method-7">-name</a>
<li><a href ="GSXMLAttribute.html#method-6">-value</a> <li ><a href ="GSXMLAttribute.html#method-9">-next</a>
<li ><a href ="GSXMLAttribute.html#method-11">-prev</a>
<li ><a href ="GSXMLAttribute.html#method-12">-type</a>
<li ><a href ="GSXMLAttribute.html#method-13">-typeDescription</a>
<li ><a href ="GSXMLAttribute.html#method-8">-value</a>
</ul> </ul>
<hr><h2>Class Methods </h2> <hr><h2>Class Methods </h2>
<h3><a name ="method-0">attributeWithNode:name:value:</a></h3> <h3><a name ="method-0">attributeWithNode:name:value:</a></h3>
@ -48,7 +52,44 @@ Create a new property carried by a node.
<hr> <hr>
<h3><a name ="method-2">attributeFrom:</a></h3> <h3><a name ="method-1">descriptionFromType:</a></h3>
+ (NSString*) <b>descriptionFromType:</b> (int)type;<br>
<p>
Return the string constant value for the attribute
type given.
</p>
<hr>
<h3><a name ="method-2">typeFromDescription:</a></h3>
+ (int) <b>typeFromDescription:</b> (NSString*)desc;<br>
<p>
Return the numeric constant value for the attribute
type named. This method is inefficient, so the returned
value should be saved for re-use later. The possible
values are -
</p>
<ul>
<li >XML_ATTRIBUTE_CDATA
<li >XML_ATTRIBUTE_ID
<li >XML_ATTRIBUTE_IDREF
<li >XML_ATTRIBUTE_IDREFS
<li >XML_ATTRIBUTE_ENTITY
<li >XML_ATTRIBUTE_ENTITIES
<li >XML_ATTRIBUTE_NMTOKEN
<li >XML_ATTRIBUTE_NMTOKENS
<li >XML_ATTRIBUTE_ENUMERATION
<li >XML_ATTRIBUTE_NOTATION
</ul>
<hr>
<h3><a name ="method-4">attributeFrom:</a></h3>
+ (GSXMLAttribute*) <b>attributeFrom:</b> (void*)data;<br> + (GSXMLAttribute*) <b>attributeFrom:</b> (void*)data;<br>
<p> <p>
@ -58,7 +99,7 @@ Creation of a new Attribute from libxml data.
<hr> <hr>
<hr><h2>Instances Methods </h2> <hr><h2>Instances Methods </h2>
<h3><a name ="method-1">initWithNode:name:value:</a></h3> <h3><a name ="method-3">initWithNode:name:value:</a></h3>
- (id) <b>initWithNode:</b> (GSXMLNode*)node <b>name:</b> (NSString*)name <b>value:</b> (NSString*)value;<br> - (id) <b>initWithNode:</b> (GSXMLNode*)node <b>name:</b> (NSString*)name <b>value:</b> (NSString*)value;<br>
<p> <p>
@ -67,7 +108,7 @@ Create a new property carried by a node.
<hr> <hr>
<h3><a name ="method-3">initFrom:</a></h3> <h3><a name ="method-5">initFrom:</a></h3>
<b>This is the designated initialiser </b><br> <b>This is the designated initialiser </b><br>
- (id) <b>initFrom:</b> (void*)data;<br> - (id) <b>initFrom:</b> (void*)data;<br>
@ -77,7 +118,7 @@ Creation of a new Attribute from libxml data.
<hr> <hr>
<h3><a name ="method-4">lib</a></h3> <h3><a name ="method-6">lib</a></h3>
- (void*) <b>lib</b>;<br> - (void*) <b>lib</b>;<br>
<p> <p>
@ -86,7 +127,7 @@ Return pointer to xmlAttribute structure.
<hr> <hr>
<h3><a name ="method-5">name</a></h3> <h3><a name ="method-7">name</a></h3>
- (NSString*) <b>name</b>;<br> - (NSString*) <b>name</b>;<br>
<p> <p>
@ -95,7 +136,7 @@ Return a Attribute name.
<hr> <hr>
<h3><a name ="method-6">value</a></h3> <h3><a name ="method-8">value</a></h3>
- (NSString*) <b>value</b>;<br> - (NSString*) <b>value</b>;<br>
<p> <p>
@ -104,14 +145,14 @@ Return a value of this attribute.
<hr> <hr>
<h3><a name ="method-7">next</a></h3> <h3><a name ="method-9">next</a></h3>
- (GSXMLAttribute*) <b>next</b>;<br> - (GSXMLAttribute*) <b>next</b>;<br>
<p> <p>
Return next Attribute. Return next Attribute.
</p> </p>
<a name ="label-8">example </a> <a name ="label-10">example </a>
<pre> <pre>
@ -127,14 +168,35 @@ Return next Attribute.
<hr> <hr>
<h3><a name ="method-9">prev</a></h3> <h3><a name ="method-11">prev</a></h3>
- (GSXMLAttribute*) <b>prev</b>;<br> - (GSXMLAttribute*) <b>prev</b>;<br>
<p> <p>
Return previous Attribute. Return previous Attribute.
</p> </p>
<hr>
<h3><a name ="method-12">type</a></h3>
- (int) <b>type</b>;<br>
<p>
Return the numeric type code for this attribute.
</p>
<hr>
<h3><a name ="method-13">typeDescription</a></h3>
- (NSString*) <b>typeDescription</b>;<br>
<p>
Return the string type code for this attribute.
</p>
<hr> <hr>
</body> </body>

View file

@ -27,15 +27,18 @@
</ul> </ul>
<h2>Methods </h2> <h2>Methods </h2>
<ul> <ul>
<li><a href ="GSXMLNamespace.html#method-3">+namespaceFrom:</a> <li ><a href ="GSXMLNamespace.html#method-2">+descriptionFromType:</a>
<li ><a href ="GSXMLNamespace.html#method-5">+namespaceFrom:</a>
<li ><a href ="GSXMLNamespace.html#method-0">+namespaceWithNode:prefix:href:</a> <li ><a href ="GSXMLNamespace.html#method-0">+namespaceWithNode:prefix:href:</a>
<li><a href ="GSXMLNamespace.html#method-7">-href</a> <li ><a href ="GSXMLNamespace.html#method-3">+typeFromDescription:</a>
<li><a href ="GSXMLNamespace.html#method-4">-initFrom:</a> <li ><a href ="GSXMLNamespace.html#method-9">-href</a>
<li><a href ="GSXMLNamespace.html#method-2">-initWithNode:prefix:href:</a> <li ><a href ="GSXMLNamespace.html#method-6">-initFrom:</a>
<li><a href ="GSXMLNamespace.html#method-5">-lib</a> <li ><a href ="GSXMLNamespace.html#method-4">-initWithNode:prefix:href:</a>
<li><a href ="GSXMLNamespace.html#method-9">-next</a> <li ><a href ="GSXMLNamespace.html#method-7">-lib</a>
<li><a href ="GSXMLNamespace.html#method-6">-prefix</a> <li ><a href ="GSXMLNamespace.html#method-10">-next</a>
<li><a href ="GSXMLNamespace.html#method-8">-type</a> <li ><a href ="GSXMLNamespace.html#method-8">-prefix</a>
<li ><a href ="GSXMLNamespace.html#method-11">-type</a>
<li ><a href ="GSXMLNamespace.html#method-12">-typeDescription</a>
</ul> </ul>
<hr><h2>Class Methods </h2> <hr><h2>Class Methods </h2>
<h3><a name ="method-0">namespaceWithNode:prefix:href:</a></h3> <h3><a name ="method-0">namespaceWithNode:prefix:href:</a></h3>
@ -78,7 +81,35 @@
<hr> <hr>
<h3><a name ="method-3">namespaceFrom:</a></h3> <h3><a name ="method-2">descriptionFromType:</a></h3>
+ (NSString*) <b>descriptionFromType:</b> (int)type;<br>
<p>
Return the string constant value for the namespace
type given.
</p>
<hr>
<h3><a name ="method-3">typeFromDescription:</a></h3>
+ (int) <b>typeFromDescription:</b> (NSString*)desc;<br>
<p>
Return the numeric constant value for the namespace
type named. This method is inefficient, so the returned
value should be saved for re-use later. The possible
values are -
</p>
<ul>
<li >XML_LOCAL_NAMESPACE
</ul>
<hr>
<h3><a name ="method-5">namespaceFrom:</a></h3>
+ (GSXMLNamespace*) <b>namespaceFrom:</b> (void*)data;<br> + (GSXMLNamespace*) <b>namespaceFrom:</b> (void*)data;<br>
<p> <p>
@ -89,7 +120,7 @@
<hr> <hr>
<hr><h2>Instances Methods </h2> <hr><h2>Instances Methods </h2>
<h3><a name ="method-2">initWithNode:prefix:href:</a></h3> <h3><a name ="method-4">initWithNode:prefix:href:</a></h3>
- (id) <b>initWithNode:</b> (GSXMLNode*)node <b>prefix:</b> (NSString*)prefix <b>href:</b> (NSString*)href;<br> - (id) <b>initWithNode:</b> (GSXMLNode*)node <b>prefix:</b> (NSString*)prefix <b>href:</b> (NSString*)href;<br>
<p> <p>
@ -101,7 +132,7 @@
<hr> <hr>
<h3><a name ="method-4">initFrom:</a></h3> <h3><a name ="method-6">initFrom:</a></h3>
<b>This is the designated initialiser </b><br> <b>This is the designated initialiser </b><br>
- (id) <b>initFrom:</b> (void*)data;<br> - (id) <b>initFrom:</b> (void*)data;<br>
@ -112,7 +143,7 @@
<hr> <hr>
<h3><a name ="method-5">lib</a></h3> <h3><a name ="method-7">lib</a></h3>
- (void*) <b>lib</b>;<br> - (void*) <b>lib</b>;<br>
<p> <p>
@ -122,7 +153,7 @@
<hr> <hr>
<h3><a name ="method-6">prefix</a></h3> <h3><a name ="method-8">prefix</a></h3>
- (NSString*) <b>prefix</b>;<br> - (NSString*) <b>prefix</b>;<br>
<p> <p>
@ -132,7 +163,7 @@
<hr> <hr>
<h3><a name ="method-7">href</a></h3> <h3><a name ="method-9">href</a></h3>
- (NSString*) <b>href</b>;<br> - (NSString*) <b>href</b>;<br>
<p> <p>
@ -142,17 +173,7 @@
<hr> <hr>
<h3><a name ="method-8">type</a></h3> <h3><a name ="method-10">next</a></h3>
- (GSXMLNamespaceType) <b>type</b>;<br>
<p>
Return type of namespace.
</p>
<hr>
<h3><a name ="method-9">next</a></h3>
- (GSXMLNamespace*) <b>next</b>;<br> - (GSXMLNamespace*) <b>next</b>;<br>
<p> <p>
@ -161,6 +182,26 @@
</p> </p>
<hr>
<h3><a name ="method-11">type</a></h3>
- (int) <b>type</b>;<br>
<p>
Return numeric type code of namespace.
</p>
<hr>
<h3><a name ="method-12">typeDescription</a></h3>
- (NSString*) <b>typeDescription</b>;<br>
<p>
Return string type code of namespace.
</p>
<hr> <hr>
</body> </body>

View file

@ -32,31 +32,84 @@
</ul> </ul>
<h2>Methods </h2> <h2>Methods </h2>
<ul> <ul>
<li><a href ="GSXMLNode.html#method-3">+nodeFrom:</a> <li ><a href ="GSXMLNode.html#method-0">+descriptionFromType:</a>
<li><a href ="GSXMLNode.html#method-0">+nodeWithNamespace:name:prefix:</a> <li ><a href ="GSXMLNode.html#method-5">+nodeFrom:</a>
<li><a href ="GSXMLNode.html#method-17">-children</a> <li ><a href ="GSXMLNode.html#method-2">+nodeWithNamespace:name:prefix:</a>
<li><a href ="GSXMLNode.html#method-7">-content</a> <li ><a href ="GSXMLNode.html#method-1">+typeFromDescription:</a>
<li><a href ="GSXMLNode.html#method-16">-doc</a> <li ><a href ="GSXMLNode.html#method-20">-children</a>
<li><a href ="GSXMLNode.html#method-4">-initFrom:</a> <li ><a href ="GSXMLNode.html#method-9">-content</a>
<li><a href ="GSXMLNode.html#method-2">-initWithNamespace:name:prefix:</a> <li ><a href ="GSXMLNode.html#method-19">-doc</a>
<li><a href ="GSXMLNode.html#method-5">-lib</a> <li ><a href ="GSXMLNode.html#method-6">-initFrom:</a>
<li><a href ="GSXMLNode.html#method-22">-makeChild:name:content:</a> <li ><a href ="GSXMLNode.html#method-4">-initWithNamespace:name:prefix:</a>
<li><a href ="GSXMLNode.html#method-24">-makeComment:</a> <li ><a href ="GSXMLNode.html#method-7">-lib</a>
<li><a href ="GSXMLNode.html#method-26">-makePI:</a> <li ><a href ="GSXMLNode.html#method-25">-makeChild:name:content:</a>
<li><a href ="GSXMLNode.html#method-6">-name</a> <li ><a href ="GSXMLNode.html#method-27">-makeComment:</a>
<li><a href ="GSXMLNode.html#method-20">-next</a> <li ><a href ="GSXMLNode.html#method-29">-makePI:</a>
<li><a href ="GSXMLNode.html#method-8">-ns</a> <li ><a href ="GSXMLNode.html#method-8">-name</a>
<li><a href ="GSXMLNode.html#method-9">-nsDef</a> <li ><a href ="GSXMLNode.html#method-23">-next</a>
<li><a href ="GSXMLNode.html#method-19">-parent</a> <li ><a href ="GSXMLNode.html#method-10">-ns</a>
<li><a href ="GSXMLNode.html#method-21">-prev</a> <li ><a href ="GSXMLNode.html#method-11">-nsDef</a>
<li><a href ="GSXMLNode.html#method-10">-properties</a> <li ><a href ="GSXMLNode.html#method-22">-parent</a>
<li><a href ="GSXMLNode.html#method-12">-propertiesAsDictionary</a> <li ><a href ="GSXMLNode.html#method-24">-prev</a>
<li><a href ="GSXMLNode.html#method-28">-setProp:value:</a> <li ><a href ="GSXMLNode.html#method-12">-properties</a>
<li><a href ="GSXMLNode.html#method-14">-type</a> <li ><a href ="GSXMLNode.html#method-14">-propertiesAsDictionary</a>
<li><a href ="GSXMLNode.html#method-15">-typeDescription</a> <li ><a href ="GSXMLNode.html#method-16">-propertiesAsDictionaryWithKeyTransformationSel:</a>
<li ><a href ="GSXMLNode.html#method-31">-setProp:value:</a>
<li ><a href ="GSXMLNode.html#method-33">-type</a>
<li ><a href ="GSXMLNode.html#method-17">-type</a>
<li ><a href ="GSXMLNode.html#method-18">-typeDescription</a>
<li ><a href ="GSXMLNode.html#method-34">-typeDescription</a>
</ul> </ul>
<hr><h2>Class Methods </h2> <hr><h2>Class Methods </h2>
<h3><a name ="method-0">nodeWithNamespace:name:prefix:</a></h3> <h3><a name ="method-0">descriptionFromType:</a></h3>
+ (NSString*) <b>descriptionFromType:</b> (int)type;<br>
<p>
Return the string constant value for the node
type given.
</p>
<hr>
<h3><a name ="method-1">typeFromDescription:</a></h3>
+ (int) <b>typeFromDescription:</b> (NSString*)desc;<br>
<p>
Return the numeric constant value for the node
type named. This method is inefficient, so the returned
value should be saved for re-use later. The possible
values are -
</p>
<ul>
<li >XML_ELEMENT_NODE
<li >XML_ATTRIBUTE_NODE
<li >XML_TEXT_NODE
<li >XML_CDATA_SECTION_NODE
<li >XML_ENTITY_REF_NODE
<li >XML_ENTITY_NODE
<li >XML_PI_NODE
<li >XML_COMMENT_NODE
<li >XML_DOCUMENT_NODE
<li >XML_DOCUMENT_TYPE_NODE
<li >XML_DOCUMENT_FRAG_NODE
<li >XML_NOTATION_NODE
<li >XML_HTML_DOCUMENT_NODE
<li >XML_DTD_NODE
<li >XML_ELEMENT_DECL
<li >XML_ATTRIBUTE_DECL
<li >XML_ENTITY_DECL
<li >XML_NAMESPACE_DECL
<li >XML_XINCLUDE_START
<li >XML_XINCLUDE_END
<li >XML_SGML_DOCUMENT_NODE
</ul>
<hr>
<h3><a name ="method-2">nodeWithNamespace:name:prefix:</a></h3>
+ (GSXMLNode*) <b>nodeWithNamespace:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>prefix:</b> (NSString*)prefix;<br> + (GSXMLNode*) <b>nodeWithNamespace:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>prefix:</b> (NSString*)prefix;<br>
<p> <p>
@ -66,7 +119,7 @@
</p> </p>
<a name ="label-1">example </a> <a name ="label-3">example </a>
<pre> <pre>
@ -88,7 +141,7 @@
<hr> <hr>
<h3><a name ="method-3">nodeFrom:</a></h3> <h3><a name ="method-5">nodeFrom:</a></h3>
+ (GSXMLNode*) <b>nodeFrom:</b> (void*)data;<br> + (GSXMLNode*) <b>nodeFrom:</b> (void*)data;<br>
<p> <p>
@ -99,7 +152,7 @@
<hr> <hr>
<hr><h2>Instances Methods </h2> <hr><h2>Instances Methods </h2>
<h3><a name ="method-2">initWithNamespace:name:prefix:</a></h3> <h3><a name ="method-4">initWithNamespace:name:prefix:</a></h3>
- (id) <b>initWithNamespace:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>prefix:</b> (NSString*)prefix;<br> - (id) <b>initWithNamespace:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>prefix:</b> (NSString*)prefix;<br>
<p> <p>
@ -109,7 +162,7 @@
<hr> <hr>
<h3><a name ="method-4">initFrom:</a></h3> <h3><a name ="method-6">initFrom:</a></h3>
<b>This is the designated initialiser </b><br> <b>This is the designated initialiser </b><br>
- (id) <b>initFrom:</b> (void*)data;<br> - (id) <b>initFrom:</b> (void*)data;<br>
@ -120,7 +173,7 @@
<hr> <hr>
<h3><a name ="method-5">lib</a></h3> <h3><a name ="method-7">lib</a></h3>
- (void*) <b>lib</b>;<br> - (void*) <b>lib</b>;<br>
<p> <p>
@ -130,7 +183,7 @@
<hr> <hr>
<h3><a name ="method-6">name</a></h3> <h3><a name ="method-8">name</a></h3>
- (NSString*) <b>name</b>;<br> - (NSString*) <b>name</b>;<br>
<p> <p>
@ -140,7 +193,7 @@
<hr> <hr>
<h3><a name ="method-7">content</a></h3> <h3><a name ="method-9">content</a></h3>
- (NSString*) <b>content</b>;<br> - (NSString*) <b>content</b>;<br>
<p> <p>
@ -150,7 +203,7 @@
<hr> <hr>
<h3><a name ="method-8">ns</a></h3> <h3><a name ="method-10">ns</a></h3>
- (GSXMLNamespace*) <b>ns</b>;<br> - (GSXMLNamespace*) <b>ns</b>;<br>
<p> <p>
@ -160,7 +213,7 @@
<hr> <hr>
<h3><a name ="method-9">nsDef</a></h3> <h3><a name ="method-11">nsDef</a></h3>
- (GSXMLNamespace*) <b>nsDef</b>;<br> - (GSXMLNamespace*) <b>nsDef</b>;<br>
<p> <p>
@ -170,7 +223,7 @@
<hr> <hr>
<h3><a name ="method-10">properties</a></h3> <h3><a name ="method-12">properties</a></h3>
- (GSXMLAttribute*) <b>properties</b>;<br> - (GSXMLAttribute*) <b>properties</b>;<br>
<p> <p>
@ -178,7 +231,7 @@
Return pointer to the first attribute on this node. Return pointer to the first attribute on this node.
</p> </p>
<a name ="label-11">example </a> <a name ="label-13">example </a>
<pre> <pre>
@ -202,15 +255,15 @@
<hr> <hr>
<h3><a name ="method-12">propertiesAsDictionary</a></h3> <h3><a name ="method-14">propertiesAsDictionary</a></h3>
- (NSDictionary*) <b>propertiesAsDictionary</b>;<br> - (NSMutableDictionary*) <b>propertiesAsDictionary</b>;<br>
<p> <p>
Return attritubes and values as a dictionary. Return attributes and values as a dictionary.
</p> </p>
<a name ="label-13">example </a> <a name ="label-15">example </a>
<pre> <pre>
@ -231,7 +284,27 @@
<hr> <hr>
<h3><a name ="method-14">type</a></h3> <h3><a name ="method-16">propertiesAsDictionaryWithKeyTransformationSel:</a></h3>
- (NSMutableDictionary*) <b>propertiesAsDictionaryWithKeyTransformationSel:</b> (SEL)keyTransformSel;<br>
<p>
Return attributes and values as a dictionary, but applies
the specified selector to each key before adding the
key and value to the dictionary. The selector must be a
method of NSString taking no arguments and returning an
object suitable for use as a dictionary key.
</p>
<p>
This method exists for the use of GSWeb ... it is probably
not of much use elsewhere.
</p>
<hr>
<h3><a name ="method-17">type</a></h3>
- (GSXMLNodeType) <b>type</b>;<br> - (GSXMLNodeType) <b>type</b>;<br>
<p> <p>
@ -241,7 +314,7 @@
<hr> <hr>
<h3><a name ="method-15">typeDescription</a></h3> <h3><a name ="method-18">typeDescription</a></h3>
- (NSString*) <b>typeDescription</b>;<br> - (NSString*) <b>typeDescription</b>;<br>
<p> <p>
@ -251,7 +324,7 @@
<hr> <hr>
<h3><a name ="method-16">doc</a></h3> <h3><a name ="method-19">doc</a></h3>
- (GSXMLDocument*) <b>doc</b>;<br> - (GSXMLDocument*) <b>doc</b>;<br>
<p> <p>
@ -260,14 +333,14 @@ Return owner of this node.
<hr> <hr>
<h3><a name ="method-17">children</a></h3> <h3><a name ="method-20">children</a></h3>
- (GSXMLNode*) <b>children</b>;<br> - (GSXMLNode*) <b>children</b>;<br>
<p> <p>
Return children of this node. Return children of this node.
</p> </p>
<a name ="label-18">example </a> <a name ="label-21">example </a>
<pre> <pre>
- (GSXMLNode*) nextElement: (GSXMLNode*)node - (GSXMLNode*) nextElement: (GSXMLNode*)node
@ -292,7 +365,7 @@ Return children of this node.
<hr> <hr>
<h3><a name ="method-19">parent</a></h3> <h3><a name ="method-22">parent</a></h3>
- (GSXMLNode*) <b>parent</b>;<br> - (GSXMLNode*) <b>parent</b>;<br>
<p> <p>
@ -301,7 +374,7 @@ Return parent of this node.
<hr> <hr>
<h3><a name ="method-20">next</a></h3> <h3><a name ="method-23">next</a></h3>
- (GSXMLNode*) <b>next</b>;<br> - (GSXMLNode*) <b>next</b>;<br>
<p> <p>
@ -310,7 +383,7 @@ Return next node.
<hr> <hr>
<h3><a name ="method-21">prev</a></h3> <h3><a name ="method-24">prev</a></h3>
- (GSXMLNode*) <b>prev</b>;<br> - (GSXMLNode*) <b>prev</b>;<br>
<p> <p>
@ -319,7 +392,7 @@ Return previous node.
<hr> <hr>
<h3><a name ="method-22">makeChild:name:content:</a></h3> <h3><a name ="method-25">makeChild:name:content:</a></h3>
- (GSXMLNode*) <b>makeChild:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>content:</b> (NSString*)content;<br> - (GSXMLNode*) <b>makeChild:</b> (GSXMLNamespace*)ns <b>name:</b> (NSString*)name <b>content:</b> (NSString*)content;<br>
<p> <p>
@ -332,7 +405,7 @@ Return previous node.
Return previous node. Return previous node.
</p> </p>
<a name ="label-23">example </a> <a name ="label-26">example </a>
<pre> <pre>
@ -357,7 +430,7 @@ Return previous node.
<hr> <hr>
<h3><a name ="method-24">makeComment:</a></h3> <h3><a name ="method-27">makeComment:</a></h3>
- (GSXMLNode*) <b>makeComment:</b> (NSString*)content;<br> - (GSXMLNode*) <b>makeComment:</b> (NSString*)content;<br>
<p> <p>
@ -366,7 +439,7 @@ Return previous node.
parent children list. parent children list.
</p> </p>
<a name ="label-25">example </a> <a name ="label-28">example </a>
<pre> <pre>
d = [GSXMLDocument documentWithVersion: @"1.0"]; d = [GSXMLDocument documentWithVersion: @"1.0"];
@ -380,7 +453,7 @@ Return previous node.
<hr> <hr>
<h3><a name ="method-26">makePI:</a></h3> <h3><a name ="method-29">makePI:</a></h3>
- (GSXMLNode*) <b>makePI:</b> (NSString*)content;<br> - (GSXMLNode*) <b>makePI:</b> (NSString*)content;<br>
<p> <p>
@ -389,7 +462,7 @@ Return previous node.
added at the end of parent children list. added at the end of parent children list.
</p> </p>
<a name ="label-27">example </a> <a name ="label-30">example </a>
<pre> <pre>
d = [GSXMLDocument documentWithVersion: @"1.0"]; d = [GSXMLDocument documentWithVersion: @"1.0"];
@ -404,14 +477,14 @@ Return previous node.
<hr> <hr>
<h3><a name ="method-28">setProp:value:</a></h3> <h3><a name ="method-31">setProp:value:</a></h3>
- (GSXMLAttribute*) <b>setProp:</b> (NSString*)name <b>value:</b> (NSString*)value;<br> - (GSXMLAttribute*) <b>setProp:</b> (NSString*)name <b>value:</b> (NSString*)value;<br>
<p> <p>
Set (or reset) an attribute carried by a node. Set (or reset) an attribute carried by a node.
</p> </p>
<a name ="label-29">example </a> <a name ="label-32">example </a>
<pre> <pre>
id n1 = [GSXMLNode nodeWithNamespace: nil name: nodeName]; id n1 = [GSXMLNode nodeWithNamespace: nil name: nodeName];
@ -423,6 +496,26 @@ Set (or reset) an attribute carried by a node.
</pre> </pre>
<hr>
<h3><a name ="method-33">type</a></h3>
- (int) <b>type</b>;<br>
<p>
Return the numeric type code for this node.
</p>
<hr>
<h3><a name ="method-34">typeDescription</a></h3>
- (NSString*) <b>typeDescription</b>;<br>
<p>
Return the string type code for this node.
</p>
<hr> <hr>
</body> </body>

View file

@ -31,10 +31,6 @@
#ifndef __GSXML_H__ #ifndef __GSXML_H__
#define __GSXML_H__ #define __GSXML_H__
/* libxml headers */
#include <tree.h>
#include <entities.h>
#include <Foundation/NSObject.h> #include <Foundation/NSObject.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <Foundation/NSDictionary.h> #include <Foundation/NSDictionary.h>
@ -46,12 +42,6 @@
@class GSXMLNode; @class GSXMLNode;
@class GSSAXHandler; @class GSSAXHandler;
typedef xmlElementType GSXMLElementType;
typedef xmlEntityType GSXMLEntityType;
typedef xmlAttributeType GSXMLAttributeType;
typedef xmlElementTypeVal GSXMLElementTypeVal;
typedef xmlNsType GSXMLNamespaceType;
@interface GSXMLDocument : NSObject @interface GSXMLDocument : NSObject
{ {
@ -90,10 +80,12 @@ typedef xmlNsType GSXMLNamespaceType;
BOOL native; BOOL native;
} }
+ (NSString*) descriptionFromType: (int)t;
+ (GSXMLNamespace*) namespaceWithNode: (GSXMLNode*)node + (GSXMLNamespace*) namespaceWithNode: (GSXMLNode*)node
href: (NSString*)href href: (NSString*)href
prefix: (NSString*)prefix; prefix: (NSString*)prefix;
+ (GSXMLNamespace*) namespaceFrom: (void*)data; + (GSXMLNamespace*) namespaceFrom: (void*)data;
+ (int) typeFromDescription: (NSString*)d;
- (id) initWithNode: (GSXMLNode*)node - (id) initWithNode: (GSXMLNode*)node
href: (NSString*)href href: (NSString*)href
@ -104,7 +96,8 @@ typedef xmlNsType GSXMLNamespaceType;
- (void*) lib; - (void*) lib;
- (GSXMLNamespace*) next; - (GSXMLNamespace*) next;
- (NSString*) prefix; - (NSString*) prefix;
- (GSXMLNamespaceType) type; - (int) type;
- (NSString*) typeDescription;
@end @end
@ -115,8 +108,11 @@ typedef xmlNsType GSXMLNamespaceType;
void *lib; /* pointer to struct xmlNode from libxml */ void *lib; /* pointer to struct xmlNode from libxml */
BOOL native; BOOL native;
} }
+ (NSString*) descriptionFromType: (int)t;
+ (GSXMLNode*) nodeWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name; + (GSXMLNode*) nodeWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name;
+ (GSXMLNode*) nodeFrom: (void*) data; + (GSXMLNode*) nodeFrom: (void*) data;
+ (int) typeFromDescription: (NSString*)d;
- (id) initWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name; - (id) initWithNamespace: (GSXMLNamespace*)ns name: (NSString*)name;
- (id) initFrom: (void*) data; - (id) initFrom: (void*) data;
@ -133,8 +129,9 @@ typedef xmlNsType GSXMLNamespaceType;
- (GSXMLNode*) prev; - (GSXMLNode*) prev;
- (GSXMLAttribute*) properties; - (GSXMLAttribute*) properties;
- (NSMutableDictionary*) propertiesAsDictionary; - (NSMutableDictionary*) propertiesAsDictionary;
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:(SEL)keyTransformSel; - (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:
- (GSXMLElementType) type; (SEL)keyTransformSel;
- (int) type;
- (NSString*) typeDescription; - (NSString*) typeDescription;
- (GSXMLNode*) makeChildWithNamespace: (GSXMLNamespace*)ns - (GSXMLNode*) makeChildWithNamespace: (GSXMLNamespace*)ns
@ -153,10 +150,13 @@ typedef xmlNsType GSXMLNamespaceType;
@interface GSXMLAttribute : GSXMLNode @interface GSXMLAttribute : GSXMLNode
{ {
} }
+ (NSString*) descriptionFromType: (int)t;
+ (GSXMLAttribute*) attributeWithNode: (GSXMLNode*)node + (GSXMLAttribute*) attributeWithNode: (GSXMLNode*)node
name: (NSString*)name name: (NSString*)name
value: (NSString*)value; value: (NSString*)value;
+ (GSXMLAttribute*) attributeFrom: (void*)data; + (GSXMLAttribute*) attributeFrom: (void*)data;
+ (int) typeFromDescription: (NSString*)d;
- (id) initWithNode: (GSXMLNode*)node - (id) initWithNode: (GSXMLNode*)node
name: (NSString*)name name: (NSString*)name
@ -167,7 +167,8 @@ typedef xmlNsType GSXMLNamespaceType;
- (GSXMLNamespace*) ns; - (GSXMLNamespace*) ns;
- (GSXMLAttribute*) next; - (GSXMLAttribute*) next;
- (GSXMLAttribute*) prev; - (GSXMLAttribute*) prev;
- (GSXMLAttributeType) type; - (int) type;
- (NSString*) typeDescription;
- (NSString*) value; - (NSString*) value;
@end @end

View file

@ -28,13 +28,6 @@
#include <config.h> #include <config.h>
/* libxml headers */
#include <parser.h>
#include <parserInternals.h>
#include <SAX.h>
#include <HTMLparser.h>
#include <xmlmemory.h>
#include <Foundation/GSXML.h> #include <Foundation/GSXML.h>
#include <Foundation/NSData.h> #include <Foundation/NSData.h>
#include <Foundation/NSValue.h> #include <Foundation/NSValue.h>
@ -45,6 +38,15 @@
#include <Foundation/NSCharacterSet.h> #include <Foundation/NSCharacterSet.h>
#include <Foundation/NSFileManager.h> #include <Foundation/NSFileManager.h>
/* libxml headers */
#include <tree.h>
#include <entities.h>
#include <parser.h>
#include <parserInternals.h>
#include <SAX.h>
#include <HTMLparser.h>
#include <xmlmemory.h>
extern int xmlDoValidityCheckingDefaultValue; extern int xmlDoValidityCheckingDefaultValue;
extern int xmlGetWarningsDefaultValue; extern int xmlGetWarningsDefaultValue;
@ -263,10 +265,43 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt);
@implementation GSXMLNamespace : NSObject @implementation GSXMLNamespace : NSObject
static NSMapTable *nsNames = 0;
+ (void) initialize + (void) initialize
{
if (self == [GSXMLNamespace class])
{ {
if (cacheDone == NO) if (cacheDone == NO)
setupCache(); setupCache();
nsNames = NSCreateMapTable(NSIntMapKeyCallBacks,
NSNonRetainedObjectMapValueCallBacks, 0);
NSMapInsert(nsNames,
(void*)XML_LOCAL_NAMESPACE, (void*)@"XML_LOCAL_NAMESPACE");
}
}
+ (int) typeFromDescription: (NSString*)desc
{
NSMapEnumerator enumerator;
NSString *val;
int key;
enumerator = NSEnumerateMapTable(nsNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
}
}
return -1;
}
+ (NSString*) descriptionFromType: (int)type
{
NSString *desc = (NSString*)NSMapGet(nsNames, (void*)[self type]);
return desc;
} }
/* This is the initializer of this class */ /* This is the initializer of this class */
@ -374,9 +409,20 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt);
} }
/* type of namespace */ /* type of namespace */
- (GSXMLNamespaceType) type - (int) type
{ {
return (GSXMLNamespaceType)((xmlNsPtr)(lib))->type; return (int)((xmlNsPtr)(lib))->type;
}
- (NSString*) typeDescription
{
NSString *desc = (NSString*)NSMapGet(nsNames, (void*)[self type]);
if (desc == nil)
{
desc = @"Unknown namespace type";
}
return desc;
} }
- (GSXMLNamespace*) next - (GSXMLNamespace*) next
@ -463,6 +509,30 @@ static NSMapTable *nodeNames = 0;
} }
} }
+ (int) typeFromDescription: (NSString*)desc
{
NSMapEnumerator enumerator;
NSString *val;
int key;
enumerator = NSEnumerateMapTable(nodeNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
}
}
return -1;
}
+ (NSString*) descriptionFromType: (int)type
{
NSString *desc = (NSString*)NSMapGet(nodeNames, (void*)[self type]);
return desc;
}
+ (GSXMLNode*) nodeWithNamespace: (GSXMLNamespace*) ns name: (NSString*) name + (GSXMLNode*) nodeWithNamespace: (GSXMLNamespace*) ns name: (NSString*) name
{ {
return AUTORELEASE([[self alloc] initWithNamespace: ns name: name]); return AUTORELEASE([[self alloc] initWithNamespace: ns name: name]);
@ -580,9 +650,10 @@ static NSMapTable *nodeNames = 0;
- (NSMutableDictionary*) propertiesAsDictionary - (NSMutableDictionary*) propertiesAsDictionary
{ {
return [self propertiesAsDictionaryWithKeyTransformationSel: NULL]; return [self propertiesAsDictionaryWithKeyTransformationSel: NULL];
}; }
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:(SEL)keyTransformSel - (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:
(SEL)keyTransformSel
{ {
xmlAttrPtr prop; xmlAttrPtr prop;
NSMutableDictionary *d = [NSMutableDictionary dictionary]; NSMutableDictionary *d = [NSMutableDictionary dictionary];
@ -593,9 +664,11 @@ static NSMapTable *nodeNames = 0;
{ {
const void *name = prop->name; const void *name = prop->name;
NSString *key = UTF8Str(name); NSString *key = UTF8Str(name);
if (keyTransformSel)
key=[key performSelector:keyTransformSel];
if (keyTransformSel != 0)
{
key = [key performSelector: keyTransformSel];
}
if (prop->children != NULL) if (prop->children != NULL)
{ {
const void *content = prop->children->content; const void *content = prop->children->content;
@ -612,9 +685,9 @@ static NSMapTable *nodeNames = 0;
return d; return d;
} }
- (GSXMLElementType) type - (int) type
{ {
return (GSXMLElementType)((xmlNodePtr)(lib))->type; return (int)((xmlNodePtr)(lib))->type;
} }
- (NSString*) typeDescription - (NSString*) typeDescription
@ -760,15 +833,77 @@ static NSMapTable *nodeNames = 0;
@implementation GSXMLAttribute : GSXMLNode @implementation GSXMLAttribute : GSXMLNode
static NSMapTable *attrNames = 0;
+ (void) initialize + (void) initialize
{
if (self == [GSXMLAttribute class])
{ {
if (cacheDone == NO) if (cacheDone == NO)
setupCache(); setupCache();
attrNames = NSCreateMapTable(NSIntMapKeyCallBacks,
NSNonRetainedObjectMapValueCallBacks, 0);
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_CDATA, (void*)@"XML_ATTRIBUTE_CDATA");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_ID, (void*)@"XML_ATTRIBUTE_ID");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_IDREF, (void*)@"XML_ATTRIBUTE_IDREF");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_IDREFS, (void*)@"XML_ATTRIBUTE_IDREFS");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_ENTITY, (void*)@"XML_ATTRIBUTE_ENTITY");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_ENTITIES, (void*)@"XML_ATTRIBUTE_ENTITIES");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_NMTOKEN, (void*)@"XML_ATTRIBUTE_NMTOKEN");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_NMTOKENS, (void*)@"XML_ATTRIBUTE_NMTOKENS");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_ENUMERATION, (void*)@"XML_ATTRIBUTE_ENUMERATION");
NSMapInsert(attrNames,
(void*)XML_ATTRIBUTE_NOTATION, (void*)@"XML_ATTRIBUTE_NOTATION");
}
} }
- (GSXMLAttributeType) type + (int) typeFromDescription: (NSString*)desc
{ {
return (GSXMLAttributeType)((xmlAttrPtr)(lib))->atype; NSMapEnumerator enumerator;
NSString *val;
int key;
enumerator = NSEnumerateMapTable(attrNames);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&key, (void**)&val))
{
if ([desc isEqual: val] == YES)
{
return key;
}
}
return -1;
}
+ (NSString*) descriptionFromType: (int)type
{
NSString *desc = (NSString*)NSMapGet(attrNames, (void*)[self type]);
return desc;
}
- (int) type
{
return (int)((xmlAttrPtr)(lib))->atype;
}
- (NSString*) typeDescription
{
NSString *desc = (NSString*)NSMapGet(attrNames, (void*)[self type]);
if (desc == nil)
{
desc = @"Unknown attribute type";
}
return desc;
} }
- (void*) lib - (void*) lib