"Right" way to mix SAX and DOM in app

I'm writing a standalone desktop application that reads and stores data as XML files. Eventually, it might be converted to use some web services, but it's not a priority right now.
What I need to do is to use an XML file, which could be large, as kind of a database -- there are many entries, each with a unique identifier, and the application will query the file to find those it needs to match and returns those as objects I'm mapping.
At the moment, because this is a personal project and I'm using it to learn more technologies, I'm trying to (somewhat artificially) restrict myself to the pure Sun APIs. So far, my investigations have pointed to JAXP (by including Java EE 5 libraries) with StAX (including JAX-WS). Which raises two questions:
1) To do this "right", do I really need to bundle my app with the entire JaveEE+Metro stack?
2) Is there a better solution than StAX that's fully Java 5 compliant, even if it means stepping out of the Sun box? I haven't found many references to other solutions that are more recent than 2004. Is parsing XML on an app that has nothing to do with an appserver that uncommon?

More likely than not, I won't be abstracting to that degree. If the current structure isn't right, I'd update the app instead of storing that kind of information in more files.
I imagine at this point an example would be more effective. The app is itself more of an inventory browser that can jump around different searches dynamically. As an illustration, imagine that it's an inventory for DVDs. One central file will be your collection (with each entry containing a movie ID, date of purchase, etc). Another file would be more static, a list of DVDs themselves. These entries would contain information about the package itself -- how many discs? What's the title of the package? Which special features does it have? It would also point to an entry in yet another file which would have information about the film, containing biographies of the people listed under the movie credits.
Basically, I want a flatfile database that I can do joins on that are split up into different files. There are few files (here, one) that will be constantly updated by the user. The others could be modified if needed, but it's not going to be optimized for it. (For example, you could own a DVD that nobody's ever heard of, and put in the info yourself.) Periodically, one or more of the more static files is updated and will be downloaded into the app.
One of the advantages I see for this is that, in the future, I could with few changes turn this into more of a web service. Instead of pushing changes in those few files, the app would look to a web service for the data it would now find in files on the user's hard drive. But for now, it also has to be one standalone package.
To answer the question, the file that will most commonly be updated by the user is the one that I don't have problems loading into memory in full. It's the other data that it links to which I want to be able to search and load into objects dynamically. My current implementation is to run the file through SAX and grab the data as it sees it, but it's really ugly. That could very well be how I'm using it and not because I'm trying to shoehorn some functionality into a technique it doesn't fit, but I'd like to find that out. ;)

Similar Messages

  • [CS4] Best way to mix HD and SD?

    Hey guys, had some fantastic reading here that's done me a lot of good. Hopefully someone can help me out here.
    Here's the scoop - I'm working on a documentary, and we're currently trying to find the best way to mix HD and SD footage so that it's best presentable. Everything was shot on DV/HDV, so before we waste all the time capturing just to find out there are better ways to go about it, we wanted to see what others have done. Essentially, our narrative clips (think Masterpiece Theatre) are shot in HD, and we're using a lot of still images at a high enough resolution to work in HD. Only thing is, a lot of our interview clips are shot in SD, but in 16:9 so at least aspect ratio is the same.
    What would be the best way to go about this for consistent video quality? Would you recommend capturing everything in its native format, upscaling the SD footage as best as possible and exporting as HD? Bringing down the quality of the HD footage upon capture and just editing/exporting everything as SD? If you'd recommend upscaling, any advice on how to go about that? Appreciate all the help!

    Curt,
    I have never beaten him, though I do try often. Job well done!
    Now, if that lottery ticket is the big winner, the forum will suffer, as you head off to spend your $'s.
    Hunt
    PS - I agree with you both.

  • Is there an easy way to switch back and forth between apps on an iPhone 4?

    Is there an easier way to flip back and forth between apps without going through the Home button?

    By "going through the Home button" do you mean double tapping the Home button to bring up the recently used apps tray?

  • Can I Use  SAX  and DOM in same application?

    Hi,
    Here is my requirement. I am using Apache's SAX parser for my appliaction. The below xml is the sample xml i am processing.How can I know the parent of element 'C' using sax? Is there any way i can differentiate the element under <B> and under <A>? Or do i need to use DOM, when you encouter <C> and find out it's parent.?
    If any one had this situation,Please respond with some code examples.
    <A>
    <B>
    <C>aa</C>
    </B>
    <C>bb</C>
    </A>
    Thanx

    When using SAX, your application is notified about nodes as the parser encounters them, sequentially. There is no concept of a parent/child relationship for elements. When using SAX, you must develop this logic yourself.
    When using DOM, the contents of the XML file are read into a tree structure. If you have a reference to the node object that represents "C", you can get a reference to its parent by calling getParentNode().
    Hope this helps.
    Greg
    >
    Hi,
    Here is my requirement. I am using Apache's SAX parser
    for my appliaction. The below xml is the sample xml i
    am processing.How can I know the parent of element 'C'
    using sax? Is there any way i can differentiate the
    element under <B> and under <A>? Or do i need to
    use DOM, when you encouter <C> and find out it's
    parent.?
    If any one had this situation,Please respond with
    some code examples.
    <A>
    <B>
    <C>aa</C>
    </B>
    <C>bb</C>
    </A>
    Thanx

  • SAX and DOM - treating encoding differently ??

    Hello!
    I have run into a strange problem - I was parsing my xml document using
    WebLogic's DOM and SAX parsers to compare their performance, and I found
    that while using their DOM parser I was able to parse the document just
    fine, using the SAX parser gave me an error:
    org.xml.sax.SAXParseException: Declared encoding "UTF-8" does not match
    actual one "ISO8859_1"
    I don't use any extended characters in the xml document, and even if I
    did - I'm puzzled as to why DOM parser would process it without
    complaining but the SAX paser would not??
    Thanks,
    Marina

    Hello!
    I have run into a strange problem - I was parsing my xml document using
    WebLogic's DOM and SAX parsers to compare their performance, and I found
    that while using their DOM parser I was able to parse the document just
    fine, using the SAX parser gave me an error:
    org.xml.sax.SAXParseException: Declared encoding "UTF-8" does not match
    actual one "ISO8859_1"
    I don't use any extended characters in the xml document, and even if I
    did - I'm puzzled as to why DOM parser would process it without
    complaining but the SAX paser would not??
    Thanks,
    Marina

  • What's the right way to export contents (and meta-info) for a playlist?

    I have a huge iTunes library and want to move a part of it onto a netbook (running a Linux music manager) with much less disk space. I can put the things I want to move into a separate playlist. Now, how do I export them onto a flashdrive (to move it to the other machine) such that things like album art, descriptive info, and other meta-data move along with it? Is it possible?
    Mike

    Does the netbook have a CD drive?
    nope, but I have a 4 gig thumbdrive to do the transfer with and the netbook has a 16 gig solid state disk in it.
    As far as I know, there's no easy way to do what you want to. If the netbook
    doesn't have a CD drive, I might reccommend burning a disc anyway. Make sure
    you select to burn a File CD, not a music CD. Then, put the CD in your
    computer (not the netbook) and copy the files to a Flash Drive. I might be
    able to find a better solution. I'll get back to you if I do.
    interesting. Does the "file CD" then contain metadata such as album art, lyrics, etc.? thanks!
    Mike

  • Is it right way to nest HBox and VBox for screen design ?

    Hi,
    I am designing main screen of my application which contains lots of HBox and VBox.
    Which makes application slow and complicated.
    So is there any other way of doing it?
    Thanks.

    Grid layout? (still in preview)
    MiGLayout in JFXtras? (still in beta for 1.3, AFAIK)
    [Custom Layout|http://learnjavafx.typepad.com/weblog/2010/05/a-javafx-13-custom-layout-example.html]? (hard...)

  • Is there a way to manage (arrange and add/delete) apps from within itunes while I have my iphone 4S connected to computer... instead of doing it on the phone itself? I have an unreasonable number of apps and need to clean it all up.

    I have a replacement phone and have saved a backup but ideally before or, if need be, directly after I restore from backup I would love to clean up my apps.  I have over 2000 apps which I clearly don't use all at once so like to keep most of them sitting in itunes however recently life got messy and so did my phone so much so that I just lost control of what was on it and not on it because of a forgotten wifi synch that I'd not disabled so randomly id get apps appearing on my phone that I'd deleted ages and ages ago.  Anyway the notion of having to fix it all on the phone with the jiggling icons is a painful one... I am hoping I can do it via my lap top instead.  Anyone? all search efforts have not arrived me at the info I seek.

    Yes, connect your iPhone to your computer, click onthe name of your iPhone then click on the apps tab in iTunes.

  • In Java Mapping Whether to SAX or DOM ?

    While implementing Java Mapping which of the following SAX , DOM parsers  is the most efficient way to implement it.
    I mean considering the voulume of data in the XML format is large which  usage will give me most  optimal performance .
    It would be nice if someone could give a sample most  optimal java code using JAXP where  input stream is read  and after  processing written to  output stream.
    regards
    Nilesh Taunk.

    Hi Nilesh,
    >>>While implementing Java Mapping which of the following SAX , DOM parsers is the most efficient way to implement it.
    there's no one good answer fot this question
    except: it depends:)
    SAX and DOM are a little different parsers
    so it depends what will your java mapping
    have to do: if it will change the
    structure or maybe it will only change a few tags,
    or maybe it will do something else
    have a look at the page below to read a simple
    comparision between SAX and DOM
    http://www.scit.wlv.ac.uk/~jphb/cp2101/week4/XML_Parsing.html
    or this thread:
    http://www.biglist.com/lists/xsl-list/archives/200301/msg01318.html
    they will give you some idea which one to choose
    depending on your requirements
    BTW
    remember use java mappings only
    if you cannot use graphical mapping (very easy debugging)
    and if your document cannot be parsed (maybe huge documents)
    with XSLT which is supported by many graphilal tools
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Right way of configuring higher MTU over a Port Channel

    Hi guys,
    I have a running critical Port-Channel between two locations.
    Here's the config
    SW1:
    interface Port-channel2
     switchport
     switchport trunk encapsulation dot1q
     switchport mode trunk
    end
    interface GigabitEthernet1/45
     switchport trunk encapsulation dot1q
     switchport mode trunk
     channel-protocol lacp
     channel-group 2 mode active
    end
    interface GigabitEthernet1/46
     switchport trunk encapsulation dot1q
     switchport mode trunk
     channel-protocol lacp
     channel-group 2 mode active
    end
    SW2
    interface GigabitEthernet1/1
     switchport trunk encapsulation dot1q
     switchport mode trunk
     channel-protocol lacp
     channel-group 2 mode passive
    end
    interface GigabitEthernet1/2
     switchport trunk encapsulation dot1q
     switchport mode trunk
     channel-protocol lacp
     channel-group 2 mode passive
    end
    interface Port-channel2
     switchport
     switchport trunk encapsulation dot1q
     switchport mode trunk
    end
    Now I need to increase the MTU from default value to 9198. What the right way to do it and avoid any connectivity loss, PortChannel restart.
    Does it matter what switch I start first?
    Thanks!
    L.E. both SW are WS-C4948

    Hi,
    Because you are using layer 2 interfaces - there is no fragmentation support at layer 2, and interfaces receiving frames which have an unsupported size will be dropped.
    I think the best way for you to proceed is to lab this up; and verify what happens - it may be that you need to make changes on switches at either end of the channel within a very short time frame to prevent too large an outage.
     When you are ready to maike your change - think the best way to do this is to use the interface range command, and apply the 'mtu' command to all the interfaces in this range. I don't think it matters which switch you apply this change to first, and I don't believe if you are hinting at the 802.3ad (controlled by system-priority) decision maker, that it makes any difference.
    HTH
    Mike

  • Mix published and unpublished events in one calendar?

    Just got an iPhone.
    Is there a way to mix published and unpublished events in one calendar?
    I've heard that other calendar software have this option.
    With iCal on a Mac it's possible to choose which calendars to view, so then it's not a problem to have one published and one unpublished calendar.
    But with iCal on iPhone you can only choose between viewing ONE and ALL calendars.
    I subscribe to a bunch of other peoples calendars, so viewing ALL is never an option..
    So now I would like to write all my events, published and private, into ONE calendar. Is that possible?
    Anyone?

    Yes. I tried changing the setting to Sync All Events (instead of the time limited sync) and let it refresh. No change. No display
    I also tried rescheduling the event by one hour on the same day (no other changes), then save. No change. No display.
    I ended up deleting the events and re-entering them, with identical information (including the recurring end date, remarks, etc., you name it), and then the events appeared like the rest of them in the same calendar.
    I'd still like to know if there is a solution to the original problem. I'm still concerned that other events, maybe in the other calendar as well, are no appearing and it's impossible to rely on a sample or to verify every event.
    Thanks for your assistance.

  • Mixing public and private networks on the same switch

    Hello Everyone,
    I know this may get some security engineers in frenzy but wanted to know if there is a safe way to mix public and private networks on the same switch. 
    We have many remote offices that we want to add public wifi and a couple of other services that would be completely outside of our internal network.  Each office has a 3750 with plenty of open ports.  How can I safely create a vlan for public access on these switches which currently have our internal network on.  I have read that people are doing this to save on the cost of purchasing a dedicated switch.  Some people are using access lists and one person mentioned creating a private vlan for the public network.  I looked up private vlan and it seemed bit confusing.
    Is this recommended?  If not what would be the safest way to do this?
    Thanks Everyone

    Disclaimer
    The  Author of this posting offers the information contained within this  posting without consideration and with the reader's understanding that  there's no implied or expressed suitability or fitness for any purpose.  Information provided is for informational purposes only and should not  be construed as rendering professional advice of any kind. Usage of this  posting's information is solely at reader's own risk.
    Liability Disclaimer
    In  no event shall Author be liable for any damages whatsoever (including,  without limitation, damages for loss of use, data or profit) arising out  of the use or inability to use the posting's information even if Author  has been advised of the possibility of such damage.
    Posting
    How "safe" is relative.  If your running just one VLAN on a switch, that's would be the safest (basically the same as mixing traffic on the same wire - separation is done else where).
    If you multiple VLANs on a switch, then you need to determine how likely someone might figure out a way to breach the VLAN barriers.  (This isn't so easy on newer switches.)  If the VLAN isolation is breeched, then you need to examine what does that imply from a security perspective (for example can someone now inject or receive other VLAN traffic).
    For most purposes, I don't see mixing public and private VLANs, alone, on the same switch as much of a risk.  More of a concern is what can be reached on either VLAN and how well it's protected.

  • Is there a way to "mix" the nodes and leaves of the tree so if they are at the same level, they will display in a specified order.

    Is there a way to "mix" the nodes and leaves of the tree so that even if they are at the same level (1,2,3...), they will display in a specified order (via sort sequence, alphabetical, etc.).
    History:
    We are using the Tree UI element to display/manage a material bom interface. We seem to be running into an issue with displaying the nodes/leaves of the tree.. regardless of the order that the context is built (which is currently the order of the exploded BOM from from CS_BOM_EXPL_MAT_V2), the bom is displayed with the nested boms at the top of each level and the single materials below them. For example. If  TK1 contains Material1, Material2, Material3, Kit1(containing component1, comp2, comp3), Material4, Kit2(containing comp4, comp5, comp6), and Material5 (in this order), the tree will display with the A level node as TK1, the next node as Kit1 (with its subleaves of comp1,comp2,comp3), Kit2(with subleaves of comp4,comp5,comp6), THEN Material1, material2, material3, material4, material5.  Our users are adamant about the items displaying in the correct order (which should be alphabetical based on the description for one report and by location for purposes of inventory for another). I've searched but not been able to locate a similar question. If I've missed it, please point me in the right direction. The users want the tree,  not a "tree" table.  This is our first attempt at the tree, so maybe we're missing something basic?
    TK1
    -Mat1
    -Mat2
    -Mat3
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Mat4
    -Kit2
    --Comp4
    --comp5
    --comp6
    -Material5
    displays as
    TK1
    -Kit1
    --Comp1
    --Comp2
    --Comp3
    -Kit2
    --Comp4
    --Comp5
    --Comp6
    -Mat1
    -Mat2
    -Mat3
    -Mat4
    -Mat5

    co-workers said example picture is misleading.. we can make the order work if everything is a "folder" but not a mix of "folders" and "files" (if making a visual reference to the windows browser). i.e - a file is represented as an empty folder.
    TK1    
    . Mat1
    . Mat2
    . mat3
    > kit1   
    .. comp1
    .. comp2
    .. comp3
    . mat4
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat5
    displays at
    TK1
    > kit1
    .. comp1
    .. comp2
    .. comp3
    > kit2
    .. comp4
    .. comp5
    .. comp6
    . mat1
    . mat2
    . mat3
    . mat4
    . mat5
    we can make it work if everything is a folder. This is our current workaround.
    TK1
    > mat1
    > mat2
    > mat3
    v kit1 (when expanded)
    .. comp1
    .. comp2
    .. comp3
    > mat4
    > kit2 (when not expanded)
    > mat5

  • The "right" way to handle multiple devices, accounts and the cloud?

    Perhaps a bit premature, but I figure it's never too early to start planning. 
    Here's our current setup - I currently have four iDevices in the faily (three iPhones and one iPod Touch.  All are syncing to the same Mac Mini, albeit with different logins (and different iTunes store ids).  All four of these are kept in sync via Home Sharing so we have access to the music/apps/etc acquired by the others.
    Enter the iCloud - how does this fit in?  What's the *right* way to do this? 
    I can see two options:
    1)     Continue to utilize four iTunes store ids, sync them via Home Sharing and add four iClouds
         Advantages
              totally independent devices, users, etc.
         Disadvantages
              must pay for four "iTunes Match" services to access non-iTunes music on each of the four devices
              will iTunes-purchased music automaticaly sync to iCloud if it is shared via Home Sharing (or only by the original purchaser)?
    2)     Use one iTunes Store id for all iDevices
         Advantages
              single point of acquisition and distribution for all devices
         Disadvantages
              need to find a way to merge IDs (is this even possible?)
    Are there other advantages/disadvantages to these options?  Are there other options?  What's the easiest to set up and support?  Any other thoughts?
    Thanks in advance for your input.

    Well it seems like the first thing you should do is consolidate your iTunes libraries so that you don't have 4 copies of everything, one for each user logged in to your Mac Mini. How you do that is consolidate all 4 iTunes folders to one folder located in the /Users/Shared/ folder and update each of your iTunes to point to that folder accordingly. That way you have one iTunes library, only one copy of your media, but accessible from multiple users.
    One caveat is that if somebody is logged on and has iTunes open, you can't fast switch to another user and open iTunes. Apple made it so that only one user and one instance of iTunes can open a iTunes library at a time.
    For your iTunes match situation, it does sound like you would be much better off sharing a single Apple ID with one iTunes Match. For consolidating, make sure you have everything everybody has shared via Home Sharing to the main account you'd like to move over to, and then simply go to each device Settings, Store, and the sign out of the original Apple ID and logon using the shared main Apple ID. I just looked at it and the automatic downloading is already live in iOS! You can specify if you want to do music, apps, and books separately in case you may want to automatically download music but not apps or books.

  • I am unable to open new tabs, in any way I attempt to do so. I have checked the settings and they are fine, so it's not those. The only way I can open a new tab is to right click on a link and instruct it to open in a new tab.

    Any way I attempt to open new tabs, be it clicking on the new tab button or using the short-cut Ctrl-t, I am unable to open any new tabs on my browser window.
    The only way I have found that I can open a new tab is to right-click on a link and instruct that link to open in a new window.

    Try disabling the Ask Toolbar extension.

Maybe you are looking for

  • Keeping imac on for numerous days straight.

    I use my elgato eye tv to record tv shows and then I convert it to ipod format so that I can watch it on my ipod video. However, converting numerous tv shows takes a while so I leave my imac on overnight quite often. My question is: Is it harmful to

  • Can I use Apple TV purchased in France in USA?  Is power switchable 110/220?

    can I use Apple TV purchased in France in USA?  Is power switchable 110/220?  I can't find any reference to voltage in instructions or on device

  • Server caught unhandled exception from servlet [jsp]

    pls click on url http://210.239.141.154/evweb/taikaikakunin.jsp email : [email protected] password : 1111 click the button of continue below to textboxes in yellow color. error comes http://210.239.141.154/evweb/taikaikakunin.jsp. is anybody can tell

  • Iam not able to have audio in lync meetings

    I am using win8 in my laptop and lync2013 ,by using webapp I can join the meetings from my off. I am able to have IM---but there is no audio .i checked the audio connection -it is working in Skype. some times total lync is hanging out. there is probl

  • IOS 6.1.3 Ringtone not working

    After upgrading my iPhone 4S 32Gb to iOS 6.1.3 I have experinced that the ringtone doesn't work after an undefined time. If the phone is turned off and on again the ringtone works on an incomming call. after one night it stops working again. why is t