|
Re: Dynamyc URL extracted from XML - BIRT [message #718921 is a reply to message #718815] |
Thu, 25 August 2011 15:37 |
|
Can you try a beforeFactory script similar to this?
importPackage( Packages.javax.xml.parsers);
importPackage( Packages.org.xml.sax);
importPackage( Packages.org.w3c.dom);
importPackage( Packages.java.io);
importPackage(Packages.java.net);
function getTagValue(file, tagName) {
factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
document = builder.parse( new InputSource( new FileInputStream( file ))
);
nlist = document.getElementsByTagName(tagName);
return nlist.item(0).getFirstChild().getNodeValue();
}
mydburl = getTagValue("c:/test/parms.xml", "dburl");
If it is a url instead of the FileInputStream try:
dataURL = new URL("myurl");
dataConnection = dataURL.openConnection();
document = builder.parse( new InputSource(
dataConnection.getInputStream() )) );
Make sure to close the connection/file
Jason
On 8/25/2011 8:14 AM, Fabricio wrote:
> Hi,
> I am using BIRT 2.6.2
> and I need to extract my database source's URL from and XML file in a
> remote location.
> I have no idea how to do it, since the XML cannot be use as a source for
> another source.
> Maybe a script on before open. But I have no idea how to implement it...
> I'll appreciate any help...
|
|
|
Powered by
FUDForum. Page generated in 0.03620 seconds