Forums
Hi
I understand I can parse an ILOB to get a pointer to the DOM root of the document by using ILOB_httpRequest.
I can then output XML verbatim doing this:
ILOB_SetWriteBinary(respILOB : *ON);
ResponseWriteILOB(respILOB);
However, can I get a pointer to an element within the DOM tree?
The reason is, when forwarding XML to the client, I wish to be able to insert a stylesheet reference after the xml header line, so if I could gain reference to the root element of the document's data, that'd be cool.
Many thanks...
Edward
Re: Getting XML pointers
I've found the some answers in ASP header file XMLPARSER.RPGLE, the functions Xml_Locate and friends. However, I'll no longer be outputting the ILOB verbatim, so I still wish to know how to send to the client an XML sub-tree starting from a given node.
Thanks!
P.S. What does Xml_Dump do?
Re: Getting XML pointers
I've managed to do this:
ILOB_SubILOB(respILOB : respILOB : 22 :
ILOB_GetLength(respILOB) - 22 : 0);
ILOB_SetData(respILOB : ILOB_GetLength(respILOB) - 22 : respILOB);
%><?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?><%
Which kind of crops 22 characters from the XML (the header!), and then replaces it with a new header including a stylesheet reference. Not respILOB contains XML to begin with.
Seems like a hack though, especially the "ILOB cropping". Hmmm.
Re: Getting XML pointers
Hi edward;
Cropping is not the best way ..
The XML parser has a feature that produces an output from a specific node, which was locatet using X-path
xml_writeStmf(node : outfile);
This will not render the responseobject directly, but in combination with loading a stream file to an ILOB and the place that ILOB in the response you are good to go;