RS

Hi:

I'm trying to read large XML documents using the Context.getXMLParser() from where I expect to retrieve a JDOM parser for navegating through the XML tree. Unfortunately, I get a "Java heap space" error which finishes, abruptly, the execution of the script, probably due to the size of those documents.

Known some disadvantages of using DOM-like APIs for reading XML documents (like a proved high memory consumption), I'm figuring how to achieve my goal with other alternatives, like using a (Java) SAX-compliant XML Parser... 

Did anyone do this before? Any suggestions?

All the help you can provide me will be highly appreciated.

Best regards,

Ricardo

 

by Jens Heylmann
Posted on Mon, 11/12/2012 - 10:00

Hi Ricardo,

it is possible to use an alternative XML parser like SAX. In a report script you can call Java.Packages. To load a XML file for example:

 

this.init2 = function() {
        try {
           var locale = Packages.com.idsscheer.utils.locale.ALocaleConverter.getLocale( Context.getSelectedLanguage() ).getLanguage();
           var filedata = Context.getFile("filename.xml", Constants.LOCATION_COMMON_FILES);           
                            
           var factory = new Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
           factory.setValidating(true);                        
           var builder = factory.newDocumentBuilder();            
           propertiesfile = builder.parse( new java.io.ByteArrayInputStream( new java.lang.String( filedata ).getBytes("UTF-8") ) );                                   
        } catch(e) {           
            //do nothing       
        }
    }

Regards,

Jens

0
by Ricardo Siguero Martín Author
Posted on Tue, 11/13/2012 - 15:01

In reply to by ignaciocardenal

Hi Jens,

First of all, thank you very much for your help.

Many years have passed since the last time I use SAX in a development, so some of my statements may not be as exact as I would like. Sorry for that...

The main issue I have to face with is the creation of the ContentHandler(DefaultHandler)-derived type, in order to implement the startElement(), endElement(), characters(),... methods which manage the XML document in a proper way, that is:

1) Read the XML structure (XML nodes or nodesets)

2) Create some ARIS structures (models, objects and connections) using the previously read data. At this point, the ARIS Javascript-based API should be used in order to do the expected work but... within a Java type? 

From my current point of view, that's something I am not able to understand about how to carry it out...

Any idea?

Thanks, in advance, for all your help.

Regards,

Ricardo

 

 

 

 

0
by julien biaussat
Posted on Thu, 11/15/2012 - 17:45

Hi Ricardo,

I have quiet the same pbm i want to parse the xml file of a database :

var xmlExportOptionsWrapper = xmlExport.createDefaultXMLExportRootOptions(sourceDb.RootGroup(), [1033]);

but the xmlExportResultWrapper2.getFileResult(); --> JAVA HEAP SPACE

I tried -Xmx in launcher.cfg...

I you have any suggestion... i'll take it...

 

0
by julien biaussat
Posted on Thu, 11/15/2012 - 17:46

and dli.cfg as well :

db.jvm.params=-Xmx2048m -Dderby.system.durability\=test -Dderby.storage.pageReservedSpace\=0

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock