Hello to everybody,
my question is simple: i need to read the CDATA string into dataOra node ...
<?xml version="1.0" encoding="UTF-8"?>
-<lettera>
<type>L1/L2</tipo>
-<dataOra><![CDATA[Verona, li 21/10/2014]]></dataOra>
</lettera>
I created a codeunit exposed, with a method with a input parameter, a bigtext variable by ref.
In this way, a website call the cu exposed, passing the variable filled, ready to be processed by Nav.
I'm using XMLDOM.
I choice to use CDATA, because in this way it's possible (maybe..) to manage also character not supported such as àòù ....
Thank's to everybody.
Egon
0
Comments
('Microsoft XML, v6.0'.IXMLDOMCDATASection)
Great !
thank's a lot for your answer ...
So i have the code below
CREATE(XmlDoc);
TempBlob.INIT;
TempBlob.Blob.CREATEOUTSTREAM(writeStream);
XMLInput.WRITE(writeStream);
TempBlob.CALCFIELDS(Blob);
TempBlob.Blob.CREATEINSTREAM(readStream);
XmlDoc.load(readStream);
XmlDomRoot := XmlDoc.documentElement;
Type := XmlDomRoot.getElementsByTagName('type').item(0).text;
where
XmlDoc 'Microsoft XML, v6.0'.DOMDocument60
XmlDomRoot 'Microsoft XML, v6.0'.IXMLDOMElement
XMLInput:
<letter>
<type>L1/L2</type>
<dataOra><![CDATA[Verona, li 21/10/2014]]></dataOra>
</letter>
i declared as you suggested a variable 'Microsoft XML, v6.0'.IXMLDOMCDATASection, but in my sample, how can i read the content of dataOra node?
Thank's a lot for your help....
Egon
I thought it was clear, because i wrote also that i need to read the CDATA string, not to write ....
It's a pity .... I hoped in your solution ...
Thank's a lot however ...
Egon
You might see that sometimes NodeDataOra has several childnodes so you should check for this.
Thank's, i tried and it's WORK fine ...
Below my code where:
XML is the follow const:
<letter>
<type>DAS/DLS</type>
<dataOra><![CDATA[Verona, li 21/10/2014]]></dataOra>
</letter>
XMLBig is a BigText
XMLDoc is 'Microsoft XML, v6.0'.DOMDocument60
XMLDomRoot is 'Microsoft XML, v6.0'.IXMLDOMElement
XMLCDATA is 'Microsoft XML, v6.0'.IXMLDOMCDATASection
dataTxt is a string 1024
XMLBig.ADDTEXT(XML);
TempBlob.Blob.CREATEOUTSTREAM(OutXMLStream);
XMLBig.WRITE(OutXMLStream);
TempBlob.CALCFIELDS(Blob);
TempBlob.Blob.CREATEINSTREAM(InXmlStream);
CLEAR(XmlDoc);
CREATE(XmlDoc);
XmlDoc.load(InXmlStream);
XmlDomRoot := XmlDoc.documentElement;
XMLCDATA := XmlDoc.createCDATASection(XmlDomRoot.getElementsByTagName('dataOra').item(0).text);
Len := XMLCDATA.length;
IF Len > 0 THEN
REPEAT
dataTxt := XMLCDATA.substringData(StartPos, MAXSTRLEN(dataTxt));
StartPos += STRLEN(dataTxt);
UNTIL StartPos = Len;
You are a beautiful man thanks for posting this