Browse Source

* fixed libxml2 examples (removed BAD_CAST)

git-svn-id: trunk@14127 -
ivost 15 years ago
parent
commit
f5ecc64f00

+ 3 - 3
packages/libxml/examples/io2.pas

@@ -29,9 +29,9 @@ begin
   (*
   (*
    * Create the document.
    * Create the document.
    *)
    *)
-  doc := xmlNewDoc(BAD_CAST('1.0'));
-  n := xmlNewNode(nil, BAD_CAST('root'));
-  xmlNodeSetContent(n, BAD_CAST('content'));
+  doc := xmlNewDoc('1.0');
+  n := xmlNewNode(nil, 'root');
+  xmlNodeSetContent(n, 'content');
   xmlDocSetRootElement(doc, n);
   xmlDocSetRootElement(doc, n);
 
 
   (*
   (*

+ 1 - 1
packages/libxml/examples/reader1.pas

@@ -32,7 +32,7 @@ var
 begin
 begin
   name := xmlTextReaderConstName(reader);
   name := xmlTextReaderConstName(reader);
   if not assigned(name) then
   if not assigned(name) then
-    name := BAD_CAST('--');
+    name := '--';
 
 
   value := xmlTextReaderConstValue(reader);
   value := xmlTextReaderConstValue(reader);
 
 

+ 14 - 14
packages/libxml/examples/tree2.pas

@@ -31,41 +31,41 @@ begin
   (*
   (*
    * Creates a new document, a node and set it as a root node
    * Creates a new document, a node and set it as a root node
    *)
    *)
-  doc := xmlNewDoc(BAD_CAST('1.0'));
-  root_node := xmlNewNode(nil, BAD_CAST('root'));
+  doc := xmlNewDoc('1.0');
+  root_node := xmlNewNode(nil, 'root');
   xmlDocSetRootElement(doc, root_node);
   xmlDocSetRootElement(doc, root_node);
 
 
   (*
   (*
    * Creates a DTD declaration. Isn't mandatory.
    * Creates a DTD declaration. Isn't mandatory.
    *)
    *)
-  dtd := xmlCreateIntSubset(doc, BAD_CAST('root'), nil, BAD_CAST('tree2.dtd'));
+  dtd := xmlCreateIntSubset(doc, 'root', nil, 'tree2.dtd');
 
 
   (*
   (*
    * xmlNewChild() creates a new node, which is "attached" as child node
    * xmlNewChild() creates a new node, which is "attached" as child node
    * of root_node node.
    * of root_node node.
    *)
    *)
-  xmlNewChild(root_node, nil, BAD_CAST('node1'), BAD_CAST('content of node 1'));
+  xmlNewChild(root_node, nil, 'node1', 'content of node 1');
 
 
   (*
   (*
    * The same as above, but the new child node doesn't have a content
    * The same as above, but the new child node doesn't have a content
    *)
    *)
-  xmlNewChild(root_node, nil, BAD_CAST('node2'), nil);
+  xmlNewChild(root_node, nil, 'node2', nil);
 
 
   (*
   (*
    * xmlNewProp() creates attributes, which is "attached" to an node.
    * xmlNewProp() creates attributes, which is "attached" to an node.
    * It returns xmlAttrPtr, which isn't used here.
    * It returns xmlAttrPtr, which isn't used here.
    *)
    *)
-  node := xmlNewChild(root_node, nil, BAD_CAST('node3'), BAD_CAST('this node has attributes'));
-  xmlNewProp(node, BAD_CAST('attribute'), BAD_CAST('yes'));
-  xmlNewProp(node, BAD_CAST('foo'), BAD_CAST('bar'));
+  node := xmlNewChild(root_node, nil, 'node3', 'this node has attributes');
+  xmlNewProp(node, 'attribute', 'yes');
+  xmlNewProp(node, 'foo', 'bar');
 
 
   (*
   (*
    * Here goes another way to create nodes. xmlNewNode() and xmlNewText
    * Here goes another way to create nodes. xmlNewNode() and xmlNewText
    * creates a node and a text node separately. They are "attached"
    * creates a node and a text node separately. They are "attached"
    * by xmlAddChild()
    * by xmlAddChild()
    *)
    *)
-  node := xmlNewNode(nil, BAD_CAST('node4'));
-  node1 := xmlNewText(BAD_CAST('other way to create content (which is also a node)'));
+  node := xmlNewNode(nil, 'node4');
+  node1 := xmlNewText('other way to create content (which is also a node)');
   xmlAddChild(node, node1);
   xmlAddChild(node, node1);
   xmlAddChild(root_node, node);
   xmlAddChild(root_node, node);
 
 
@@ -75,16 +75,16 @@ begin
   for i := 5 to 6 do
   for i := 5 to 6 do
   begin
   begin
     buff := 'node'+inttostr(i);
     buff := 'node'+inttostr(i);
-    node := xmlNewChild(root_node, nil, BAD_CAST(buff), nil);
+    node := xmlNewChild(root_node, nil, buff, nil);
 
 
     for j := 1 to 3 do
     for j := 1 to 3 do
     begin
     begin
       buff := 'node'+inttostr(i)+inttostr(j);
       buff := 'node'+inttostr(i)+inttostr(j);
-      node1 := xmlNewChild(node, nil, BAD_CAST(buff), nil);
+      node1 := xmlNewChild(node, nil, buff, nil);
       if j mod 2 = 0 then
       if j mod 2 = 0 then
-        xmlNewProp(node1, BAD_CAST('odd'), BAD_CAST('no'))
+        xmlNewProp(node1, 'odd', 'no')
       else
       else
-        xmlNewProp(node1, BAD_CAST('odd'), BAD_CAST('yes'));
+        xmlNewProp(node1, 'odd', 'yes');
     end;
     end;
   end;
   end;