Setting up SAX and Crimson

Hello.
Thanks in advance for any help or advice.
I am trying to parse XML. I have done a bit of background reading and made a few attempts - but i am stuck.
I would like to parse XML using Crimson. I would like to use SAX as the API to that parser (hope i have got things correct so far?).
I instanciate my parser as follows:
import org.xml.sax.*;
import org.xml.sax.helpers.XMLReaderFactory;
import javax.xml.parsers.*;
// this code is in a class called ClientXMLParser
try
               SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
               try
                    saxParser = saxParserFactory.newSAXParser();
               catch( ParserConfigurationException e )
                    System.out.println( "Error: " + e );
               gameXMLParser = new GameXMLParser();
               xmlReader = XMLReaderFactory.createXMLReader();
          catch( SAXException e )
               System.out.println( "Error: " + e );
          }I have another class that acts as my hanlder class:
import org.xml.sax.helpers.DefaultHandler;
public class GameXMLParser extends DefaultHandler
     public GameXMLParser()
          super();
     public void startDocument()
          System.out.println( "Start document" );
    public void endDocument()
         System.out.println( "End document" );
}So this is pretty much all i have at the moment.
I understand that i have to have:
1) A SAX2-compatible XML parser installed on your Java class path.
(I chose Crimson and just put the .jar in my jdk lib directory).
How do i know that my SAX API knows about my XML parser.
I am confused about the overall structure of how to set things up. I thought all i needed was SAX, Crimson and Java?
I am not parsing a File - but i construct a file out of Strings and just want to parse the XML document as a string, (it is sent from Macromedia Flash):
serverData += '<?xml version="1.0" encoding="utf-8"?>\n';
          serverData += '<flashClient id="' + 123456 + '">\n';
          serverData += '<getPlayers />\n';
          serverData += '</flashClient>\n';Regards, Sam

Hello.
Thanks in advance for any help or advice.
I am trying to parse XML. I have done a bit of background reading and made a few attempts - but i am stuck.
I would like to parse XML using Crimson. I would like to use SAX as the API to that parser (hope i have got things correct so far?).
I instanciate my parser as follows:
import org.xml.sax.*;
import org.xml.sax.helpers.XMLReaderFactory;
import javax.xml.parsers.*;
// this code is in a class called ClientXMLParser
try
               SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
               try
                    saxParser = saxParserFactory.newSAXParser();
               catch( ParserConfigurationException e )
                    System.out.println( "Error: " + e );
               gameXMLParser = new GameXMLParser();
               xmlReader = XMLReaderFactory.createXMLReader();
          catch( SAXException e )
               System.out.println( "Error: " + e );
          }I have another class that acts as my hanlder class:
import org.xml.sax.helpers.DefaultHandler;
public class GameXMLParser extends DefaultHandler
     public GameXMLParser()
          super();
     public void startDocument()
          System.out.println( "Start document" );
    public void endDocument()
         System.out.println( "End document" );
}So this is pretty much all i have at the moment.
I understand that i have to have:
1) A SAX2-compatible XML parser installed on your Java class path.
(I chose Crimson and just put the .jar in my jdk lib directory).
How do i know that my SAX API knows about my XML parser.
I am confused about the overall structure of how to set things up. I thought all i needed was SAX, Crimson and Java?
I am not parsing a File - but i construct a file out of Strings and just want to parse the XML document as a string, (it is sent from Macromedia Flash):
serverData += '<?xml version="1.0" encoding="utf-8"?>\n';
          serverData += '<flashClient id="' + 123456 + '">\n';
          serverData += '<getPlayers />\n';
          serverData += '</flashClient>\n';Regards, Sam

Similar Messages

  • I would like to set up my email on the apple tv as well as have my husband's email on there so we can view both sets of photos and videos - it is already set up in his name - how do i add my name so as to view my photo library from all of my devices?

    I would like to set up my email on the apple tv as well as have my husband's email on there so we can view both sets of photos and videos - it is already set up in his name - how do i add my name so as to view my photo library and songs from MY phone ?

    this is not a reply - i asked the question - still trying to learn how all this works - someone please HELP ME

  • I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great

    I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great!

    The fact that you can receive means you have a valid e mail address, and have established the connection to the incoming server, so all of that works.  Since the send does not work, that means your outgoing server is rejecting whatever settings you used formthe outgoing set up.  Try them again. 
    Google your particular isp, and ipad and many times you will find the exact settings needed for your isp.  Or tell us here, and soneone else may be on the same isp.  Some mail services need you to change a port, or have a unique name for the outgoing server.  
    Kep trying.

  • No data in Business Process Analytics after setting up BPA and BPMon

    Hi,
    I have followed the BPA set up guide and done all the configuration for BPA. I have set up BPMon for a solution and in the logical component node i have done configuration for many application monitors.
    Also in the "Load Master Data" node the master data is loaded. But still in BPA when I am selecting the time frame and applying it I am getting a message that no data is applicable in the selected time frame.
    How can i get the data in BPA.

    Hi Vishal,
    1435043 - E2E Workload Analysis - No applicable data found
    specially section 3) EFWK Resource Manager Job, wehre you find several
    hints to check this job and the EFWK Adminsitration.
    Also check note: 894279 Background processing in SAP Solution Manager
    Please have a look at following chapter of the the BPA Setup
    guide to fully understand the data flow in this application:
    2 Architecture of Business Process Analytics
      > 2.1 Data Retrieval and Reporting
    Please also review following chapter, in to see if there are any errors
    extracting the data from the managed systems to SAP Solution Manager:
    3.2.3 Checking status of Solution Manager Diagnostics Extractor
    Framework (EFWK)
    Also check:
    1570282, 1643303 and 1602437
    thanks
    Regards,
    Vikram

  • HT2477 I just purchased the IMac and was in the process of setting it up and got locked out.  A password is being requested and I did not establish one.  Is there a default password for the imac?

    I just purchased the iMac and was in the process of setting it up and it locked up, requiring me to put in a password.  I never established a password, does the iMac have a default password?

    If you have been using the mac.com Apple ID to make iTunes purchases recently, then there should be no issues continuing to use it with the new iPhone. I would abandon the new ID as you will never get Apple to merge the two IDs. I have had a mac.com ID for years and continue to use it with my iPhone 4S.
    Tell us the issues that you encounter trying to set up the iPhone with the mac.com account.

  • Problem with setting custom attribute and it being searchable

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

    I'm having an issue with setting a custom attribute and having it be searchable using Portal 10.1.4. The situation that we have is that we initially added a bunch of files to Oracle Portal using webdrive. Later on, we decided that we needed another custom attribute called "Pinned Item" that will be used for searching (boolean value) and gave it a default value of false. The attribute was then added to the "File" item type in the "Shared Objects" group.
    It appears that since this attribute wasn't initially available on the file object, we couldn't search on it so we decided to set it programatically. First, I tried using wwsbr.set_attribute but it errored out seemingly because the value wasn't set in the first place. If I set a value first by using the web front end, I could then use the set_attribute procedure.
    So, I moved on to using wwsbr_api.modify_item and it appears to set it (although everything is being set to false until I changed it to "text" instead of "boolean" which is OK because that's what I wanted anyway... see metalink bug 390618.1). I'm using the method outlined in metalink doc 413079.1. When I do set it to a "1", and edit the item the check box is checked indicating that it is set correctly. And if I just click "OK" to save the attributes after I open it everything works like it should.
    However, the advanced search (and custom search portlet) and the search APIs are not picking it up. I'm not sure if I'm hitting Metalink bug ID 5592472 or not as that's using the "set_attribute" procedure instead of the modify_item procedure. And their "workaround" of setting the attribute in the UI isn't really feasible for a couple thousand files.
    So far I've tried the following things to get it working:
    1. I am calling wwpro_api_invalidation.execute_cache_invalidation
    2. I have executed wwv_context.sync
    3. I cleared the page group cache
    4. I invalidated all of the web cache
    Does anyone else have any other suggestions?

  • I am having a big problem. I am not getting notifications from snapchat and only snapchat. I've made sure every notification setting was on and it just won't work. I have also restored my phone and deleted the app and re-downloaded it multiple times. Help

    I am having a big problem. I am not getting notifications from snapchat and only snapchat. I've made sure every notification setting was on and it just won't work. I have also restored my phone and deleted the app and re-downloaded it multiple times. It just wont give me my notifications. Help please.

    Go to Settings > Privacy > Location Services.
    Turn off SnapChat.
    Go to Settings > Notification Center
    Turn off SnapChat.
    Restart the device.
    Go to Settings > Privacy > Location Services.
    Turn on SnapChat.
    Go to Settings > Notification Center
    Turn on SnapChat.
    Test the issue.

  • Report Generation broken after deployment - Excel Set Cell Color and Border.vi

    Upon deployment, the Excel Set Cell Color and Border.vi became broken.  After installing LV2010 SP1 to view the VIs in the deployment, I noticed that in the second case structure where the code draws the border using the BorderAround invoke node, there is an extra variant input parameter named 'Parameters'.  Upon right-clicking, an option to 'Relink Invoke Node' appeared and after selecting this, the extra input disappeared and the VI was no longer broken.
    Why does "Relink Invoke Node" appear?  How do I create a deployment with this issue?  Has anybody else experienced this?  Why is the TestStand deployment so buggy?  

    Hi Ching-Hwa,
    I have set up a test deployment here where I am deploying a workspace that contains a sequence file.  This sequence file has a LabVIEW Action Step calling a VI that opens a new Excel file and simply calls the Excel Set Cell Color and Border VI.  After deploying this, both the VI and my test sequence ran on the deployment machine without error.  Therefore, I do have some more questions to more accurately reproduce what you are seeing.
    First, what operating systems are you developing on and deploying to?  Also, what license do you have for TestStand on the machine you are deploying to?  If you have a development version, can you manually take the sequence file and VI to this machine and run it?  I know you now have LabVIEW 2010 SP1 on your development machine, but if you have the development version of TestStand as well, it would be interesting to see if you copy the files over if you still see this behavior.  Are you including the TestStand Engine in the deployment?
    Can you open a blank VI on the deployment machine and add the Excel Set Cell Color and Border VI?  It would also be interesting to see if this is not a product of the deployment, but rather an issue with something on the deployment machine itself.  What version of the Report Generation Toolkit do you have on each machine?  Also, what versions of Excel are you using on the development and deployment machine?  Again, it would be helpful for me to know exactly what versions you have installed on both the development and deployment machines so that I can reproduce this as accurately as possible.
    One last thing to try, too, would be to try deploying the VI by itself just to see if it also has the same behavior.  Do you have the Application Builder in LabVIEW?  If so, could you also try building an executable from the VI, create an installer, and deploy this to the deployment machine?  
    In regards to the "freezing" of code by removing the block diagrams, I do not believe this will be a proper work around in this case.  While this removes the block diagram from actually being deployed along with the VI and restricts users from editing the code on the deployment machine, if something is getting changed in the compiled code upon deployment, this will not stop this from happening.  This option is available more as a memory option to lower the size of the deployment as well as prohibit any users on the development machine from editing the block diagram themselves.    
    Thanks, Ching-Hwa!  I look forward to your response so that I can continue trying to reproduce this issue.  Have a great day! 
    Taylor G.
    Product Support Engineer
    National Instruments
    www.ni.com/support

  • "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. ;)

  • N8; How to set up SIP and make (WiFI & 3G)VOIP cal...

    N8 only comes with SIP software and you need to download the the VoIP setting software at this link (use VoIP 3.1):
    http://www.forum.nokia.com/info/sw.nokia.com/id/d476061e-90ca-42e9-b3ea-1a852f3808ec/SIP_VoIP_Settin... 
    You can use the N8 web browser and load directly from the site to the phone.
    then go to:
    Menu>settings>connectivity>Admin.Settings>SIP settings
    option>New SIP Profile>use default profile.
    This window needs to be configured with your VoIP provider setting which may be found on their site or just do a search. I used the settings from my previous phone. I have Gizmo VoIP and will be using the setting for this service as an example to set up Wifi and 3G SIP setting
    Profile Name> Gizmo, (assign the name of your provider e.g.. Gizmo, Google talk, etc)
    Service profile> IETF
    Default Destination> WiFi
    Public username: sip:[email protected] (Input your VoIP provider info)
    Use compression> No
    Registration> When needed
    Use security> No
    Then goto Proxy server:
    Proxy server address> siproxy01.sipphone.com (use your provider proxy address setting)
    Realm> proxy01.sipphone.com (use your provider setting)
    Username> (use your username)
    Password> (enter your password0
    Allow loose routing> Yes
    Transport type> UDP
    Port> 5060
    Go back and then go to Registrar server:
    Registrar server address> siproxy01.sipphone.com (use your provider Registrar setting)
    Real> proxy01.sipphone.com (use your provider setting)
    Username> (use your username)
    Password> (enter password)
    Transport type> UDP
    Port> 5060
    Again folks above is just an example. You must use your provider settings.
    Then when you are done go back to:
     Admin setting> Net setting>Advance VoIP setting>Create new service> choose the SIP profile shown, e.g.  Gizmo 
    This will configure the VoIP setting with the particular SIP profile. It will also add a SIP Tel profile Pane in your Contacts folder, Internet call option to the contacts list and Phone log.
    Now go to the SIP pane in Contacts folder, sign in and then make a test call . To make a SIP call just go to a contact and choose Internet call. If you configured everything correctly, it should work and you are done.
    For 3G connection, follow above direction and create new SIP profile with new name (e.g. Gizmo (3G). All settings are same except:
    Default destination>Internet
    Then set up the VoIP setting with the new SIP profile by going to:
    Admin setting>Net setting>Advance VoIP settings>Create new service> Choose the SIP profile you just configured e.g. Gizmo (3G)
    Then:
    Admin setting>Net setting>Advance VoIP settings>VoIP service>choose the 3G SIP profile, e.g. Gizmo (3G)>Profile setting>>>>>
    Go down to AWCDMA> set it to "on"
    Exit out of everything. Go to SIP (3G) pane in the Contacts folder. Sign in and make test call.
    I have configured many Mobile phones and found the N8 somewhat touchy. But, the sound quality on Gizmo VoIP using both WiFi and 3G was great, no echo or any problems.
    Useful hints:
    If it does not connect or make a call, you need to check the SIP setting for any error. If you find any problem there, you must first remove the SIP profile in the Net setting. Then go to the SIP setting and correct the problem. Double check everyting, go back to Net setting>Advance VoIP setting>Create new service and add the SIP profile. The reason is that when you Configure a VoIP setting with a SIP profile, the SIP info is permanently loaded and will not change even if you make any change in the SIP profile. So any time you change anything in the SIP profile (even the password) you always need to remove, make correction and then reload the corrected SIP profile to the VoIP setting.
    There are also few Mobile service providers who have blocked VoIP on their data network service. So, just check with your service provider. In US both AT&T and TMobile have open network for VoIP.

    Hi
    I have an unbranded N8 and am trying to get VoipCheap to work.
    I have tried to set up VOIP but still facing a problem or 2 so please assist me.
    I have an active account via VoipCheap.com with a profile name and password and it is verified.
    1/ When I look in Admin Settings / Sip Settings it shows VoipCheap with "not registered" under it..why?
    My settings when I click on VoipCheap are:
    profile name: VoipCheap
    Service profile: IETF
    Default destination: Internet
    Public username: sip:[email protected]
    Use compression: No
    Registration: When needed
    Use security: No
    Proxy server address: sip:sip.VoipCheap.com
    Realm: VoipCheap.com
    Username: [email protected]
    Password:  ****** (I have entered my password)
    Allow loose routing: Yes
    Transport type: UDP
    Port: 5060
    Registrar server settings same as Proxy server settings.
    I have also gone to Net settings / VoipCheap settings and see:
    Username:  sip:[email protected]
    Password: ***** (I have entered my password)
    Default service: No
    Service connectivity: Internet
    In Contacts I have a VoipCheap tab with the icon for internet calling and it says
    Sign in (example)
    but when I click on this it shows connecting (via my internet connection) but hangs there - it does not seem to connect............
    what do you think I am doing wrong, please ????????????????

  • I was setting up my Airport and thought the first set up did not go through, so I set up again and I ended up with two accounts instead of one.  How can I manage to have only one account now? Thanks for the help.

    I was setting up my Airport and thought the first set up dod not go through, then I set up again and ended up with two wireless accounts.  I use it for the prointer and the iPad, and I can see both accounts in the iPad.  How do I get rid of one account?  Thanks for the help!

    me.com accounts can be used for iCloud.  See the FAQ section in:
    <http://support.apple.com/kb/ht4895>
    but it may be too late if you have already created a new AppleID.
    A few years ago Apple said they were working on allowing account merging, but it never happened (maybe objections from copyright holders).

  • I just got my new iPhone4 set up today and it has pulled in every email that is in my desk top as being unread.  Yet I have read all the emails.  Still the iPhone thinks they are unread.  Does anyone know how I can delete all of these at one time?

    I just got my new iPhone4 set up today and it has pulled in every email that is in my desk top as being unread.  Yet I have read all the emails.  Still the iPhone thinks they are unread.  Does anyone know how I can delete all of these emails at one time from the phone?

    I have taken it back to the Apple store genius bar, but they say they don't see anything wrong. Well unless you use it all day and experience the problems when they happen, you wont see anything wrong. But there are lots wrong with it. But this would be the same store as I purchased the phone. And they backed up my old Iphone 4, but were not able to get anything to load back onto my new phone. So, I lost pretty much everything. But over time, some of my contacts have started showing up, although i am still missing over 800 of them.

  • I have two time capsules (1TB, 2TB) and want to use one for another set of Macs (my Family). How do I set both up and keep all the Macs from joining both Time Capsules?

    I Have two Time Capsules (1TB and 2TB) and want to set one for business and the other for family - networking seperate Macs to each.

    Both should be plugged into the network with ethernet.. if at all possible.
    If you have a router already then both bridged otherwise one set to router and one to bridge.
    How do you access the TC? Ethernet or wireless?
    Are they located in the same area?
    You could set different wireless networks.. if they use wireless.. this is nice easy way to do it.
    You can set user account in the TC you want the business one to join with.. that will prevent access by the family.
    So there is a number of ways.. none are particularly secure btw.. the TC is a home not a business device.. if anybody wants access they press the reset for one second.. pofff all the passwords are default for 5min.. to allow people who forget their password to get access.
    On ML you can encrypt TM backups.. this is better for security if that is the problem.. and still use different user profile to prevent access.

  • HT4993 how to set up icloud account on a phone if you have already set one up and it was spelled wrong?

    i accidentally spelled my email wrong when i was setting up icloud and now its not allowing me to correct it! how can i fix this!

    Delete the account then re add it.  Go to settings-icloud- scroll to the bottom delete, then add the CORRECT account.

  • I purchased an ipad from a dealer on ebay with a 9 month warranty still on it.  I set it up and decided to return it and buy the new Ipad instead. How can I be sure I didn't activate the warranty, or deactivate if it has been activated?

    I purchased an ipad from a dealer on ebay with a 9 month warranty still on it.  I set it up and decided to return it and buy the new Ipad instead. How can I be sure I didn't activate the warranty, or deactivate if it has been activated?

    Sorry, I can't tell what it is you're trying to ask. What does the warranty have to do with your intention to return the iPad (to whomever) and get another one?
    There's no way to deactivate a warranty.
    The warranty transfers with the machine, has nothing to do with the owner.
    Look around in the Support pages, you can figure out a way to type in your serial number and see what your current warranty status is.

Maybe you are looking for