| Author |
Creating additional lines
|
|
|
| I have an xml file that looks like this
<xml>
<record id="1">
<field1>data1</field1>
<field2>data1</field2>
</record>
<record id="2">
<field1>data2</field1>
<field2>data1</field2>
</record>
<record id="3">
<field1>data3</field1>
<field2>data3</field2>
</record>
</xml>
my output needs to be this
<xml>
<record id="1">
<field1>data1</field1>
<field2>data1</field2>
</record>
<record id="2">
<field1>data2</field1>
<field2>data1</field2>
</record>
<record id="2">
<field1>data2</field1>
<field2>data1</field2>
</record>
<record id="3">
<field1>data3</field1>
<field2>data3</field2>
</record>
</xml>
I need to ADD a record to the already existing records, how do I do that?
Thanks
| |
| esuyer@gmail.com 2005-09-22, 8:58 pm |
| you'll need a .net type i.e.
class RecordHelper {
public void AddRecord( TypedXmlDoc recordDoc, int recordid, string
field1, string field2 ) {
XmlDocument d = recordDoc.OwnerDocument;
XmlElement e = d.CreateElement("Record");
XmlAttribute _a = d.CreateAttribute("Id");
_a.InnerText = recordid.tostring();
e.Attributes.Append(_a);
XmlAttribute _a = d.CreateAttribute("field1");
_a.InnerText = field1;
e.Attributes.Append(_a);
XmlAttribute _a = d.CreateAttribute("field2");
_a.InnerText = field2;
e.Attributes.Append(_a);
recordDoc.AppendChild(e);
}
}
HTH
| |
|
| TypedXmlDoc is not in existance, am I misssing something?
<esuyer@gmail.com> wrote in message
news:1127415526.657959.188680@z14g2000cwz.googlegroups.com...
> you'll need a .net type i.e.
>
> class RecordHelper {
> public void AddRecord( TypedXmlDoc recordDoc, int recordid, string
> field1, string field2 ) {
>
> XmlDocument d = recordDoc.OwnerDocument;
> XmlElement e = d.CreateElement("Record");
>
> XmlAttribute _a = d.CreateAttribute("Id");
> _a.InnerText = recordid.tostring();
> e.Attributes.Append(_a);
>
> XmlAttribute _a = d.CreateAttribute("field1");
> _a.InnerText = field1;
> e.Attributes.Append(_a);
>
> XmlAttribute _a = d.CreateAttribute("field2");
> _a.InnerText = field2;
> e.Attributes.Append(_a);
>
> recordDoc.AppendChild(e);
> }
> }
>
>
> HTH
>
| |
| esuyer@gmail.com 2005-09-23, 5:52 pm |
| Hi Fred,
Are you trying to insert a node from within the rules engine or an
orchestration or elsewhere?
The Microsoft.RulesEngine.dll or Microsoft.RulesEngine.Extensions.dll
has a TypedXmlDocument type. If you're adding a node from within the
rules engine, you'll need to use this type.
| |
|
| I am trying to insert this inside of the map.
Sorry for the delay...
<esuyer@gmail.com> wrote in message
news:1127487120.665223.170910@g47g2000cwa.googlegroups.com...
> Hi Fred,
>
> Are you trying to insert a node from within the rules engine or an
> orchestration or elsewhere?
>
> The Microsoft.RulesEngine.dll or Microsoft.RulesEngine.Extensions.dll
> has a TypedXmlDocument type. If you're adding a node from within the
> rules engine, you'll need to use this type.
>
|
|
|
|