Thema: Prism XML Codeerstellung

Einzelnen Beitrag anzeigen

mikenrw

Registriert seit: 9. Okt 2005
11 Beiträge
 
#5

Re: XML Codeerstellung

  Alt 8. Mär 2006, 16:27
Hi,

Du hast 100% Recht. DAS ist das Prob.

Hier der Code.

Danke.

Mike



Globale Variablen:
var
xmldoc : XmlDocument;
root : XmlNode;
node : XmlNode;

procedure create_xml;
const
lang_Source_1 ='us-en';
lang_Target_1 ='de';
atrfield1 ='Source';
dataset1 ='red';
dataset2 ='rot';
begin
xmldoc := XmlDocument.Create;
root := xmldoc.CreateElement('mro');
xmldoc.AppendChild(root);
node := xmldoc.CreateElement('conceptGrp');
root.AppendChild(node);
node1 := root.SelectSingleNode('conceptGrp');
node1.AppendChild(xmldoc.CreateElement('languageGr p'));
node1 := root.SelectSingleNode('conceptGrp/languageGrp');
node1.AppendChild(xmldoc.CreateElement('language') );
node1 := root.SelectSingleNode('conceptGrp/languageGrp/language');

//ATTRIBUTE
node1.Attributes.Append(xmldoc.CreateAttribute('TY PE')).InnerText := atrfield1;
node1.Attributes.Append(xmldoc.CreateAttribute('LA NG')).InnerText := lang_Source_1;

node1.AppendChild(xmldoc.CreateElement('termGrp')) ;
node1.AppendChild(xmldoc.CreateElement('term')).In nerText := dataset1;

//´2.: BAUM

node2 := root.SelectSingleNode('conceptGrp');
//node2 := root.SelectNodes('conceptGrp');
node2.AppendChild(xmldoc.CreateElement('languageGr p'));
//AB HIER FEHLERHAFT
//node1:= root.SelectNodes('conceptGrp/languageGrp',xmlnodelist);
//node1 := root.SelectSingleNode('conceptGrp/languageGrp');
//node1.AppendChild(xmldoc.CreateElement('language') );
node1.AppendChild(xmldoc.CreateElement('language') );
//node1 := root.SelectSingleNode('conceptGrp/languageGrp/language');

//ATTRIBUTE
node1.Attributes.Append(xmldoc.CreateAttribute('TY PE')).InnerText := atrfield1;
node1.Attributes.Append(xmldoc.CreateAttribute('LA NG')).InnerText := lang_Target_1;

node1.AppendChild(xmldoc.CreateElement('termGrp')) ;
node1.AppendChild(xmldoc.CreateElement('term')).In nerText := dataset2;

xmldoc.Save('g:\mro.xml');

end;
  Mit Zitat antworten Zitat