Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dynamyc URL extracted from XML - BIRT(URL extracted from XML - BIRT)
Dynamyc URL extracted from XML - BIRT [message #718815] Thu, 25 August 2011 12:14 Go to next message
Fabricio  is currently offline Fabricio Friend
Messages: 2
Registered: August 2011
Junior Member
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...
Re: Dynamyc URL extracted from XML - BIRT [message #718921 is a reply to message #718815] Thu, 25 August 2011 15:37 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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...
Previous Topic:java dates and birt dates
Next Topic:Calendar Gif Artifact
Goto Forum:
  


Current Time: Fri Apr 26 14:43:48 GMT 2024

Powered by FUDForum. Page generated in 0.03620 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top