Home > Back-end >  Consult namespace problems generate XML file
Consult namespace problems generate XML file

Time:11-12

Using xmldocument controls to generate an XML file to provide the dimension map use, automatically add namespace problems:

The format of the need to generate:

117.23546 36.5464 55 & lt; The/gx: coord>
The 2019-04-21 T12: at 12:05 & lt;/when>


A brief code:

TrackNode:=Node AddChild (' gx: Track ');

CoordNode:=TrackNode AddChild (' gx: cood ');
CoordNode. Text:='117.23546 36.5464 55';

WhenNode:=TrackNode AddChild (' s');
WhenNode. Text:='2019-04-21 T12:12:05';

Results generated XML file automatically added to the when node gx:, namely become & lt; Gx: when> Nodes, is it because the namespace problems, how to solve?

CodePudding user response:

WhenNode:=xmlDoc CreateNode (' s');//xmlDoc into you define TXMLDocument control
WhenNode. Text:='2019-04-21 T12:12:05';
TrackNode..childnodes. Add (WhenNode);

Just doing XML format data reading and writing, practical measured

CodePudding user response:

reference 1st floor Grefen response:
WhenNode:=xmlDoc. CreateNode (' s');//xmlDoc into you define TXMLDocument control
WhenNode. Text:='2019-04-21 T12:12:05';
TrackNode..childnodes. Add (WhenNode);

Just doing XML format data reading and writing, practical measured


Thank Grefen

Use your code, the result is generated: & lt; The when XMLNS="" & gt; The 2019-07-16 T14: fetch & lt;/when>
Is automatically added to the empty namespace XMLNS=""

My head next XML file defined a namespace:
It seems that these namespace delete not to drop? How to deal with?
  • Related