Hello,
I need to read and process data from a xml file. The content of the xml file (a.xml) is
Contents of a.xml
=============
<?xml version="1.0" encoding="UTF-16LE" standalone="no"?>
<DBProfile>
<DBProfile_row>
<profilename>BaseAccounts</profilename>
<default>Y</default>
</DBProfile_row><DBProfile_row>
<profilename>BaseAccounts1</profilename>
<default>N</default>
</DBProfile_row>
<DBProfile_row>
<profilename>BaseAccounts2</profilename>
<default>Y</default>
</DBProfile_row>
</DBProfile>
I tried with the following code, but all fails.
===================================================
IF fFileExist("a.xml") THEN
XMLSource = fLoadText("a.xml", foAnsi)
XMLRes = XMLDocument("XMLDoc", XMLSource)
// Was the document created?
IF XMLRes = False THEN
Error("The following problem was detected: " + ErrorInfo())
ELSE
info("The document was successfully created. It is ready to be used.")
END
XMLRes = XMLFirst("XMLDoc")
IF XMLRes = True THEN
info("First XMLElementName", XMLElementName("XMLDoc"))
info("First XMLParentName", XMLParentName("XMLDoc"))
info("First XMLElementName", XMLElementName("XMLDoc"))
info("First XMLData", XMLData("XMLDoc"))
info("FIrst XMLChild", XMLChild("XMLDoc"))
ELSE
info("first failed", ErrorInfo(errMessage))
END
XMLRes = XMLRoot("XMLDoc")
info("XML Res root ", XMLRes)
IF XMLRes = True THEN
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLParentName", XMLParentName("XMLDoc"))
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLData", XMLData("XMLDoc"))
info("Root XMLChild", XMLChild("XMLDoc"))
ELSE
info("root failed", ErrorInfo(errMessage))
END
XMLRes = XMLFind("XMLDoc", "DBProfile_row")
info("XML Res find", XMLRes)
IF XMLRes = True THEN
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLParentName", XMLParentName("XMLDoc"))
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLData", XMLData("XMLDoc"))
info("Root XMLChild", XMLChild("XMLDoc"))
ELSE
info("find failed", ErrorInfo(errMessage))
END
========================================================
I get only failed message. Am I missing anything?
Happiness Always
BKR Sivaprakash
I need to read and process data from a xml file. The content of the xml file (a.xml) is
Contents of a.xml
=============
<?xml version="1.0" encoding="UTF-16LE" standalone="no"?>
<DBProfile>
<DBProfile_row>
<profilename>BaseAccounts</profilename>
<default>Y</default>
</DBProfile_row><DBProfile_row>
<profilename>BaseAccounts1</profilename>
<default>N</default>
</DBProfile_row>
<DBProfile_row>
<profilename>BaseAccounts2</profilename>
<default>Y</default>
</DBProfile_row>
</DBProfile>
I tried with the following code, but all fails.
===================================================
IF fFileExist("a.xml") THEN
XMLSource = fLoadText("a.xml", foAnsi)
XMLRes = XMLDocument("XMLDoc", XMLSource)
// Was the document created?
IF XMLRes = False THEN
Error("The following problem was detected: " + ErrorInfo())
ELSE
info("The document was successfully created. It is ready to be used.")
END
XMLRes = XMLFirst("XMLDoc")
IF XMLRes = True THEN
info("First XMLElementName", XMLElementName("XMLDoc"))
info("First XMLParentName", XMLParentName("XMLDoc"))
info("First XMLElementName", XMLElementName("XMLDoc"))
info("First XMLData", XMLData("XMLDoc"))
info("FIrst XMLChild", XMLChild("XMLDoc"))
ELSE
info("first failed", ErrorInfo(errMessage))
END
XMLRes = XMLRoot("XMLDoc")
info("XML Res root ", XMLRes)
IF XMLRes = True THEN
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLParentName", XMLParentName("XMLDoc"))
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLData", XMLData("XMLDoc"))
info("Root XMLChild", XMLChild("XMLDoc"))
ELSE
info("root failed", ErrorInfo(errMessage))
END
XMLRes = XMLFind("XMLDoc", "DBProfile_row")
info("XML Res find", XMLRes)
IF XMLRes = True THEN
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLParentName", XMLParentName("XMLDoc"))
info("Root XMLElementName", XMLElementName("XMLDoc"))
info("Root XMLData", XMLData("XMLDoc"))
info("Root XMLChild", XMLChild("XMLDoc"))
ELSE
info("find failed", ErrorInfo(errMessage))
END
========================================================
I get only failed message. Am I missing anything?
Happiness Always
BKR Sivaprakash