* * *

Author Topic: XML Components  (Read 292 times)

J-23

  • Newbie
  • Posts: 3
XML Components
« on: November 14, 2017, 02:07:22 pm »
Hello,
In his project he reads the xml files and if the readings work correctly using the TXMLDocument component, then the methods that are responsible for replacing the node or deleting them are not implemented.

Code: Pascal  [Select]
  1. procedure TDOMNode.Changing;
  2. begin
  3.   if (nfReadOnly in FFlags) and not (nfDestroying in FOwnerDocument.FFlags) then
  4.     raise EDOMError.Create(NO_MODIFICATION_ALLOWED_ERR, 'Node.CheckReadOnly');
  5. end;
  6.  
  7.  
  8. function TDOMNode.ReplaceChild(NewChild, OldChild: TDOMNode): TDOMNode;
  9. begin
  10.   Changing;  // merely to comply with core3/nodereplacechild21
  11.   raise EDOMHierarchyRequest.Create('Node.ReplaceChild');
  12.   Result:=nil;
  13. end;
  14.  
  15. function TDOMNode.DetachChild(OldChild: TDOMNode): TDOMNode;
  16. begin
  17.   // OldChild isn't in our child list
  18.   raise EDOMNotFound.Create('Node.RemoveChild');
  19.   Result:=nil;
  20. end;
  21.  
  22.  
Here is a mention of TurboPawer XML but it does not come from here.

Can you point me to other freebies?

Regards
J-23

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1178
Re: XML Components
« Reply #1 on: November 14, 2017, 05:06:17 pm »
http://www.google.com

Or

On the left hand side of this page are a series of links.  They were put there to assist people in finding their way around this forum.  At least three of these links contain "freebies", five if you include the two Download links.

Quote
using the TXMLDocument component, then the methods that are responsible for replacing the node or deleting them are not implemented.

What?  Is there a question in here somewhere?

Lazarus Trunk/FPC Trunk on Linux & Windows [7, 8.1]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

wp

  • Hero Member
  • *****
  • Posts: 3893
Re: XML Components
« Reply #2 on: November 14, 2017, 05:15:40 pm »
Did you try the xml units which come along with fpc (dom, xmlread, xmlwrite) or lazarus (laz2_dom, laz2_xmlread, laz2_xmlwrite)? In laz2_dom I see that the TDomNode has a function DetachChild. After detaching a child node it probably can be destroyed (just guessing...). As for replacing, there's a function ReplaceChild for sure. Just browse these units.

Under all circumstances I would try to stay away from the TurboPower units. I spent quite some time with their libraries, but I've never seen such poorly written code...
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5810
Re: XML Components
« Reply #3 on: November 14, 2017, 05:25:57 pm »
Those are from Fcl-xml. But they are virtual, and they are implemented for tdomnode_withchildren, iow nodes that can actually have chlidren.

J-23

  • Newbie
  • Posts: 3
Re: XML Components
« Reply #4 on: November 15, 2017, 01:53:50 pm »
Did you try the xml units which come along with fpc (dom, xmlread, xmlwrite) or lazarus (laz2_dom, laz2_xmlread, laz2_xmlwrite)? In laz2_dom I see that the TDomNode has a function DetachChild. After detaching a child node it probably can be destroyed (just guessing...). As for replacing, there's a function ReplaceChild for sure. Just browse these units.

Under all circumstances I would try to stay away from the TurboPower units. I spent quite some time with their libraries, but I've never seen such poorly written code...

For your advice I used (laz2_dom, laz2_xmlread, laz2_xmlwrite) and it works :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus