Highlighted
Absent Member.
Absent Member.
358 views

XML File Connector?


Recently asked by Leo in another forum:

"Do we have the file connector which supported XML?"

My response:

The existing File Connector supports XML.

Read through the documentation for the File Connector and look up how to
customize the record ending characters. Normally the record-end string
is something like '\r\n' (a normal Unix/Windows line ending), but you
can set it to something like '</Event>' if you like, and the Connector
will happily slurp up an entire XML block up to the terminal </Event>
tag.

The caveat here is that the Connector also *consumes* the line-ending
char, so you have to restore it if you need it for proper XML
interpretation. So for example given the input:

<Event>
<Initiator name="joe" ip="10.0.0.1" />
<Target name="fred" ip="10.0.0.12" />
<Action time="2014-12-02T12:02:02" />
</Event>

and using '</Event>' as your 'record end' string, what you'll get in
s_RXBufferString is:

<Event>\n <Initiator name="joe" ip="10.0.0.1" />\n <Target name="fred"
ip="10.0.0.12" />\n <Action time="2014-12-02T12:02:02" />\n

If you want to use E4X to interpret this (using something like var1=new
XML(s_RXBufferString) it will fail due to the invalid XML, but you can
always do:

this.XMLDoc=new XML(this.s_RXBufferString + "</Event>");


--
DCorlette
------------------------------------------------------------------------
DCorlette's Profile: https://forums.netiq.com/member.php?userid=323
View this thread: https://forums.netiq.com/showthread.php?t=50812

0 Likes
0 Replies
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.