? - Is there a way to validate 1 XML record at a time, using the SAX or oth

Hello!
Before running into space problems, i generated an XML file from a 'pipe delimited' file and and then processed that XML file thru a SAXParser 'validator' and the data was correctly validated, using the RELAXNG Schema patterns as the validation criteria!
But as feared, the XML file was huge! (12 billion XML recs. generated from 1 billion 'pipe' recs.) and i am now trying to find a way to process 1 'pipe' record at a time, (ie) read 1 record from the 'pipe delimited' file, convert that rec. to an XML rec. and then send that 1 XML rec. thru the SAXParser 'validator', avoiding the build of a huge temporary XML file!
After testing this approach, its looks like the SAXParser 'validator' (sp.parse) is expecting only (1) StringBufferInputStream as input,and after opening, reading and closing just (1) of the returned StringBufferInputStream objects, the validator wants to close up operations!
Where i have the "<<<<<" you can see where i'm calling the the object.method that creates the 'pipe>XML' records 'sb.createxml' and will be returning many occurances of the StringBufferInputStream object, where (1) StringBufferInputStream object represents (1) 'pipe>XML' record!
So what i'm wondering, is if there is a form of 'inputStream' class that can be loaded and processed at the same time! ie instead of requiring that the 'inputStream' object be loaded in it's entirety, before going to validation?
Or if there is another XML 'validator' that can validate 1 XML record at a time, without requiring that the entire XML file be built first?
1. ---------------------------------class: (SX2) ---------------------------------------------------------------------------------------------------------
import ............
public class SX2
public static void main(String[] args) throws Exception
MyDefaultHandler dh = new MyDefaultHandler();
SX1 sx = new SX1();
SAXParser sp = sx.getParser(args[0]);
stbuf1 sb = new stbuf1();
sp.parse(sb.createxml(args[1]),dh); <<<<<< createxml( ) see <<<<<<< below
class MyDefaultHandler extends DefaultHandler {
public int errcnt;
"SX2.java" 87 lines, 2563 characters
2. ----------------------------------class: (stbuf1) method: (createxml) ----------------------------------------------------------------------------
public stbuf1 () { }
public StringBufferInputStream createxml( String inputFile ) <<<<<< createxml(
BufferedReader textReader = null;
if ( (inputFile == null) || (inputFile.length() <= 1) )
{     throw new NullPointerException("Delimiter Input File does not exist");
String ele = new String();
try {
ele = new String();
textReader = new BufferedReader(new FileReader(inputFile));
String line = null; String SEPARATOR = "\\|"; String sToken = null;
String hdr1=("<?xml version=#1.0# encoding=#UTF-8#?>"); hdr1=hdr1.replace('#','"');
String hdr2=("<hlp_data>");
String hdr3=("</hlp_data>");
String hdr4=("<"+TABLE_NAME+">");
String hdr5=("</"+TABLE_NAME+">");
while ( (line = textReader.readLine()) != null )
String[] sa = line.split(SEPARATOR);
String elel = new String();
for (int i = 0; i < NUM_COLS; i++)
if (i>(sa.length-1)) { sToken = new String(); } else { sToken = sa; }
elel="<"+_columnNames[i]+">"+sToken+"</"+_columnNames[i]+">";
if (i==0) {
ele=ele.concat(hdr1);ele=ele.concat(hdr2);ele=ele.concat(hdr4);ele=ele.concat(elel);
else
if (i==NUM_COLS - 1) {
ele=ele.concat(elel);ele=ele.concat(hdr5);ele=ele.concat(hdr3);
else {
ele=ele.concat(elel);
textReader.close();
catch (IOException e) {
return (new StringBufferInputStream(ele));
public static void main( String args[] ) {
stbuf1 genxml_obj = new stbuf1 ();
String ptxt=new String(args[0]);
genxml_obj.createxml(ptxt); }}

Well,i think you can use the streaming API for xml processing provided by weblogic.It is pull model,not push model like SAX.with it,you can select the events you want without having to react to every event,and you can filter the events out.
Sun also provide such streaming API for xml processing,and i got an very simple introduction about it on the Chinese Sun developer site.but i couldn't find any other infomation about it elsewhere! If you have such materials,please send to my email:[email protected],and if I have it,i will be sure to post the links here.hope it helps more or less:)
@smile@

Similar Messages

  • Is there any way to export IT Resource data from OIM using the export tool?

    Hello,
    we are trying to migrate an OIM development environment to a preproduction environment and we need to migrate more than 400 IT Resources. We have exported some IT Resources and when we imported them in the preproduction environment their data was not migrated. Is there any way to export IT Resource data from OIM using the export tool? Or is there any other way to do this without doing it by hand?
    Thank you for your help
    Kind Regards

    Well , OIM doesnot provide any such facility to export ITResource data along with ITResource .
    Directly updating the DB could be an option ..
    Thanks

  • Is there any way to back up my Macbook Pro without using the heap of crap that is Time Machine? It is telling me it will take 3 days to back up 100Gb. I am in my 60s and I am worried that I might not live that long

    s there any way to back up my Macbook Pro without using the heap of crap that is Time Machine? It is telling me it will take 3 days to back up 100Gb. I am in my 60s and I am worried that I might not live that long

    If you aren't going to live that long maybe you should give up with computers and start enjoying the few remaining hours.
    Suggested Backup Software
      1. Carbon Copy Cloner
      2. Data Backup
      3. Deja Vu
      4. SuperDuper!
      5. Synk Pro
      6. Tri-Backup
    Others may be found at VersionTracker or MacUpdate.
    Visit The XLab FAQs and read the FAQ on backup and restore.  Also read How to Back Up and Restore Your Files.
    You may obtain trials of the utilities via VersionTracker or MacUpdate.

  • Is there a way to filter a drop down list by using the result main data display from"GetUserProfileByName" when open the form.

    Hi 
    Is there a way to filter a drop down list by using the result main data display from"GetUserProfileByName" when open the form?
    The second source has a huge list of company names that can be narrrow by email work. 
    background:SP 2010 and Infopath 2010
    CRISTINA&amp MICROSOFT Forum

    I'm not sure if I understood your question clearly but here is a good resource on how to get attributes from "GetUserProfileByName" web services:
    http://blog.mangroveweb.com/pre-populating-an-infopath-from-with-mysql-data-using-a-net-web-service/using-sharepoints-getuserprofilebyname-web-service-to-retrieve-ad-account-information/
    Regarding filtering dropdown list then this could be done by applying form on-load rules. 
    Hope this helps

  • Is there a way to search several keywords at a time on the top right search box?

    Hello.
    Let's say I want all the images to appear that have any of these keywords:  "sky, mountain, water".  The only way I have figured out it takes too long and it's tedious.  I open the "find" window and manually add search variables to look for several keywords and file names for the values that I am looking for.
    Isn't there a way to search for files that have any of the keywords I write on the search box by dividing these keywords with commas or any other puntuation? Or am I stuck opening the "find" window and add rows of variables that I want to search?

    I really do hope you are part of the development team for the Bridge.
    If only…
    I'm just a user like you and almost all other participants. Steve (SG) is one of the very helpful Adobe Engineers who occasionally hang around every now and then but they do so out of personal interest and kindness. They also try to be a shortcut to the Bridge engineers, it is no company policy to interact directly with developers on this user to user forum...
    But if I was responsible for resources for the Bridge development team they already would have had loads of money to realize my perfect Bridge and this process would have started from CS3 and above…. but as said, I'm just a humble photographer with no knowledge at all in programming applications and by far not enough money to realize this dream app
    Regarding your Find comments, I do realize there are some extra actions needed and the less you can make the better it would be. However as said, I don't know of any DAM application capable of what you want.
    It is kind of looking into a database and that needs separate criteria to my knowledge. If I had to use the search function that much I would look for a dedicated Digital Asset Manager to do this tasks.
    I'm not very deep in to knowledge about DAM but I use Canto Cumulus Single user for my Archive which is much faster then Bridge (Bridge is much better in other tasks so I need both).
    In Canto you can create a query to customize your own search needs in a better way but this needs some extra knowledge and study, I have only 65 K of files in my archive and searching is not that difficult using the normal route of quick find.
    And to comfort you a little, both Bridge and Canto do reopen the find menu with the last settings which is still not ideal but saves a bit of moves. Having the option to save templates like in batch rename would be a big plus but it is not an option yet.
    And of course, you can also put in a feature request for this:
    http://feedback.photoshop.com/photoshop_family/

  • I share a Toshiba Qosmio with my fiance as our 'home' computer, i recently bought an iphone 4, he has a 4s why can i not sync my music to itunes? Is there a way to have 2 seperate accounts on iTunes using the same computer

    My fiance and I share our home laptop, he is awaiting his new Mac arrival.  During this time I have sold my old laptop and used this one, Toshiba Qosmio.  When i plug my iphone 4 into iTunes and try to sync the music, it prompts a window that says if i sync music his, from his iphone 4s will override mine and erase my music.  Isn't there a way I can have 2 seperate accounts or just delete his, as he is getting a new one?  I have tried uninstalling although it still comes up to his account.  TERRIBLY FRUSTRATED!!!!  I am new to the iphone, as we were Droid users prior to this.  Thank you for any help

    How to use multiple iDevices with one computer

  • Is there a way to mirror your monitor to your tv using the apple composite cable instead to just stream your video in specific situations?

    Hello,
    i bought the composite video cable out for the ipad and i want to know if there is a way to mirror the ipad monitor instead to just transmit video in specific sittuations. The same to my iphone.
    I know that there is a way to do it in jailbreak ipads or iphones (using a app, but don't want to do it).

    Thanks Dave.  When I read the manuals they did not communciate this point this clearly.
    Use one of these to connect iPad to a TV or projector:
    Apple Digital AV Adapter and an HDMI cableÂÂ
    Apple Component AV CableÂÂ
    Apple Composite AV CableÂÂ
    Apple VGA AdapterÂÂ
    If you use the Apple Digital AV Adapter or the Apple Component AV Cable, high-resolution videos are shown in HD quality. Apple cables are available for purchase in many countries. Go to www.apple.com/store.
    With iPad 2, when the cable is connected to a TV or projector, the iPad screen is automatically mirrored on the external display in up to 1080p resolution, and videos play at a maximum resolution of 720p. Some apps such as Keynote may use the external display as a second video monitor. With previous iPad models, only certain applications (including YouTube, Videos, and Photos) use the external display.

  • Is there a way to update Alternative Items and reverse link using the DTW?

    I have approximately 8,000 items that need to be tied with alternate items.  I am curious if there is a way using the DTW as opposed to manually input?
    Thanks,
    Matt

    Have you tried oAlternateCatNum template?  It is the only one close to your requirement but may not be the right one.  If it doesn't work, then it will be none due to no DI exposure.
    Thanks,
    Gordon

  • Is there a way to run Firefox updates on Macintosh computers using the command line?

    In our school district we have thousands of Macintosh computers that have Firefox installed (on Mac OS X 10.4 through 10.6). When a new update is released to fix security vulnerabilities it would be very helpful if our Tech Support Specialists could send out a command to all the Macs using Apple Remote Desktop to update Firefox. Is there a command that can be sent to update Firefox? If so, could you please tell me what the command is? Thanks so much for any help that can be provided.

    Certainly, but not with external interface.
    Have a look at the cookbooks. There are examples of how to use the root host object to call directly into extendscript.

  • Is there a way to scan a string containing % (percent symbols) using the "Scan from String" function?

    I am communicating serially with a chilled mirror device and the input string syntax contains this text: "%RH=<input value>"
    I have not been able to figure out how to tell the function that the percent here is not a format specifier. Is this possible, or should I just try to use a different function?
    Thanks.
    Mitch
    Solved!
    Go to Solution.

    Use %% in your format string so that it knows to use the percent literally.  So %%RH=%f
    EDIT:  Darin got one in there ahead of me.  It looks like either \% and %% both work.
    Attachments:
    Example_VI.png ‏10 KB

  • Is there a way to turn 'passcode on immediately' while also using the fingerprint sensor?

    If I turn my fingerprint sensor on in the new iPhone 5s to use as the passcode, it requires it to be used immediately after locking. I would like to change this to 1 minute but there aren't any other options when the fingerprint sensor is on. Is there a fix to this?

    i am wondering the same thing. Also there should be an option where you ONLY have the fingerprint unlock instead of also having the numerical password when sliding phone.

  • Is there a way to format text (ie: bold, size) when using the browser edit function

    How do you add a trademark symbol

    Text formatting/styling isn't supported through IBE at this time but you can type the Trademark symbol as mentioned in the following article, there should be no problems in syncing it back to your Muse project - http://www.wikihow.com/Type-the-Trademark-Symbol
    Thanks,
    Vinayak

  • Is there a way to create different groups for my contacts using the installed contact app

    I am trying to make a group on my contacts. So that it's easier to just make messages to people and not having to make group messages every single time. For example, making a group for a sports team so that I can just message everyone in the group at once.

    No not possible but you can create contact groups at www.icloud.com and if you have contact synced thru cloud the groups you make at www.icloud.com will appear on your phone

  • How do you effectively use if,for, type loops in TestStand. Do you have to use the goto command or is there a way of writing actual c type code (perhaps using the statement step in teststand) with the variables allready declared.

    Thank you
    Arik

    I assume your loop is more than just one step. You should use the 'Loop Options' for a single step.
    For looping on a group of steps, you can place them all in a sub sequence and then set the 'Loop Options' for the 'SequenceCall' step to set up your looping conditions. Pass values to and from the sub-sequence by Parameters.
    You can keep the loop inline with the rest of your sequence by using 'Goto' or using 'Goto destination' in the Post Actions tab of the condition step.
    Using a sub sequence will keep it easier to read and maintain.

  • When the printer dialog shows up is there a way to print by pressing enter instead of using the mouse?

    Right now, I have to click with the mouse: I don't have to do in in Firefox: Just press enter!

    I just tried it in Thunderbird and it worked for me.
    Try holding the shift key while you start Thunderbird to disable add-ons and see if that could be the cause.

Maybe you are looking for