Looking for a Generic_node-to-string utility

Hello
I'm creating a "SurveyEngine" application that will use a XML document defining the questions and storing the answers of the users. There is part of my webApp that must:
1-parse the XML file (i am ok till there)
2-append a XML child node (.. it should not be too hard, but if you have sample codes, please send)
3-translate the modified document object back to a string to overwrite the file
I need help mostly for the 3th step. I looked in the java API in the packages dom, sax, etc... and I didnt find anything. Could someone tell me which package.class I must use? If you know that such a class does not exist in the java API, but that you already defined a class to handle generic_node-to-string translation, I would be very grateful if you could send me your sources.
Thanks in advance,
Alexandre Bouchard

ok here is the parsing section of my code:
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            //basic response configurations
          response.setContentType("text/html");
          out = response.getWriter(); 
         try
            //create the DOM parser and parse the XML docs
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document document = builder.parse( new File("documents.xml") );
            ...here there will be modifications done to document
            ... and here, I want to ouput the modified document to the screen or to a file or whatever...                                                      
        catch (SAXException sxe)
        { // Error generated during parsing)
                Exception x = sxe;
                if (sxe.getException() != null)
                        x = sxe.getException();
                x.printStackTrace();
                out.println( "SAX Exception: " + sxe );
        catch (ParserConfigurationException pce)
        { // Parser with specified options can't be built
                pce.printStackTrace();
                out.println( "ParserConfigurationException: " + pce );
        catch (IOException ioe)
        { // I/O error
                ioe.printStackTrace();
                out.println( "io Exception: " + ioe );
        }All I want is a kind of document.toString() that really transform the document to a string. If you could write me some codes that do that using XMLSerializer, I would be very grateful.
I know that it wouldnt be too hard to write my own XMLToString() utility, but it would violate my First Law of Programming: Never reinvent the wheel.
Thanks a lot for your attention lk555

Similar Messages

  • Best way to look for next char in String that is NOT "-" or " " or ","?

    I have a long String that is sent to me and needs to be parsed. Normally I can figure the end of the line by a line break, but sometimes the line break is lost only after the second line. This second line contains the characters:
    These characters can all appear any number of times. I will know I'm at the end of the line when I hit a character that is not one of those three. What is the best way to look for this? Is there an already set method in the Java API?
    Thanks for all the help!

    There are solutions using regular expression, eg; you can split string once a time using minus char, whitespace or comma:
    String tokens[] = anyString.split("\\-|\\x20|,");
    More sophisticated expressions could be done to achieve results:
    String re = "^(.+)(\\-|\\x20|,)(.)(.*)$";
    Matcher m = Pattern.compile(re).matcher(anyString);
    if (m.matches()) {
    String
    before = m.group(1),
    delimiter = m.group(2),
    firstCharAfterDelimiter = m.group(3),
    suffix = m.group(4);
    Regards.

  • Looking for simple touch-to-command utility

    More and more people are using laptops these days, but the number of utilities providing extra touch functionality seems still lacking. I'm looking for a simple utility that will let me bind (multi-) touch gestures to keybindings, and preferably also commands.
    For instance:
    2-finger swipe-left > Mod1-arrowleft
    3-finger swipe-up > exec dmenu_run
    Does anyone know of such a utility?

    litemotiv wrote:
    More and more people are using laptops these days, but the number of utilities providing extra touch functionality seems still lacking. I'm looking for a simple utility that will let me bind (multi-) touch gestures to keybindings, and preferably also commands.
    For instance:
    2-finger swipe-left > Mod1-arrowleft
    3-finger swipe-up > exec dmenu_run
    Does anyone know of such a utility?
    Hey litemotiv,
    Easystroke will do that. I use it with my stylus/tablet to execute apps, commands, text, (ie: passwords, signature, etc), key-bindings, etc... While easystroke <upstream version> isn't multi-touch, there does happen to be a multi-touch version - but as a disclaimer ~ i haven't actually used the MT version. However, here is a link to the blog about it (english translation);
    http://translate.google.com/translate?u … 1&ie=UTF-8
    It's also in the AUR;
    http://aur.archlinux.org/packages.php?ID=54495
    let me know how it works out! (i plan on going multitouch soonish)
    cheerz
    Last edited by triplesquarednine (2012-01-14 21:41:09)

  • Looking for the best dynamic chart utility

    Hi-
    I'm creating a piece of software which extensively uses dynamic charts. The charts I'm using need to be updated atleast twice a second with over 10000 points on them. I've tried using jfreechart but its just too slow. I'm running a 900mhz c3 processor w/ 256 megs of ram on slackware linux 9.1. Does anyone know of a faster dynamic chart utility?
    -thanks

    Just a thought.
    I make svg 'templates' holding all the static parts of the graph and then at run time add to the DOM for example at a polyline representing (x,y) data. Extremely light weight.
    This is also in preparation for sending DOMFrags across the net to update a dynamic part of a display running on a client.

  • Looking for a keyboard/matrix mapping utility

    I am designing my own keyboard and I need an application to tell me which keys do what. A word processing program only tells me which number or letter key I am pressing; I need one that tells me which Command, or Control, or Option, or Esc. key I am pressing, as well. I have hunted online for a few hours now, but for the five million instances Google will return, what terms do I use? Key? keyboard? Map? Matrix? For all I know, there may be a mini-app for seeing which key does what-already built into the OS X system. Or in the X11 package. Nobody told me about it. Is there a shareware program that will do it?
    PM G5 PPC   Mac OS X (10.4.8)   1.5 GB RAM; 150GB & 250GB HDs
    PM G5 PPC   Mac OS X (10.4.8)   1.5 GB RAM; 150GB & 250GB HDs
    PM G5 PPC   Mac OS X (10.4.8)   1.5 GB RAM; 150GB & 250GB HDs

    The standard tool for making a custom keyboard mapping is Ukelele:
    http://scripts.sil.org/cms/scripts/page.php?siteid=nrsi&itemid=ukelele
    However, this is only for customizing characters (not functions) made with normal, shift, option, and shift+option.

  • Looking for Sync utility like Beyond Compare

    I'm looking for a folder/file synchronization utility like Beyond Compare (which is a Windows-only product). Beyond Compare has a few features that make it outstanding. I know of no Mac synchronization utilitiy that has all of these features:
    1) You can set up compare sessions with individual preferences for each.
    2) The individual preferences includes a list of file/directory names to be ignored.
    3) You can perform a compare and have it display the differences.
    4) I can dispatch file/folder moves individually and instantly.
    5) It can display differences of files (binary or text).
    The 4th item is key. While I'm displaying differences, I only see the differences. It could be dozens or hundreds or thousands of files and folders. If I conclude that folder97 needs to be sync'd to the right, I select the command from a pop-up menu and it syncs to the right and disappears off of my display as it is no longer a difference. As I go through the differences one by one, they disappear off of my screen. This goes on until I have resolved all of the differences.
    Beyond Compare is extremely powerful, flexible and intuitive. It should be a Mac app. I just wish there were something on the Mac like it.

    There is actually. It's called chronosync:
    http://www.econtechnologies.com/pages/cs/chrono_overview.html
    it does everything you listed.

  • Looking For Help for porting PC utility to Mac

    Hi,
    I am looking for local Mac developer(s)who could help me to port my MXF utility (HDV M2T=>QT conversion) to Mac OS X. I need someone who is around SF Bay Area. It's a simple program however requires knowlegde of threads. (I use worker thread. simple one) Please contact me at [email protected] if you are interested.
    <Edited by Moderator>

    Why was this merely "edited by moderator"? It should be removed or moved to the appropriate forum. Wait, there is no "solicitation" forum.
    bogiesan

  • Looking for a free iPod to iTunes music transfer utility, any suggestions

    Looking for a FREE utility that will allow me to transfer music from my iPod to my iTunes. I recently purchased a new notebook PC that I recently download a fgresh installation of iTunes. Now I need to transfer my music stored in my iPod to iTunes. I find many free transfer utilities on the internet that allow you to only transfer a couple of songs, not your whole iPod. Any suggested freeware utilities would be appreciated.
    Message was edited by: MASZR1
    Message was edited by: MASZR1

    If you enable your iPod for disk use, you should be able to do this without utilities (unless iTunes checks for this kind of thing). See, all of your music is stored (with garbled filenames) under <D:/iPod_Control/Music/> (where "D" is your iPod). So if you use iTunes's "Add Folder to Library" on the "iPod_Control/Music" folder, it should import your iPod files.
    So do this,
    1. Set Windows to show hidden files and folders, if it isn't already. There are plenty of guides for this on Google.
    2. Open iTunes.
    3. Enable disk use on your iPod, if you haven't already.
    4. Go to File > Add Folder to Library....
    5. In the Open Folder dialog box, navigate to your iPod.
    6. Go into the iPod_Control folder.
    7. Select the Music folder. Click OK.
    Note that on Windows, the iPod_Control folder (and its contents) are hidden, so you need to set Windows to show hidden files and folders.

  • Looking for a simple way to convert a string to title case

    New to LiveCycle and Javascript.  Looking for a simple way to convert a string to title case, except acronyms.  Currently using the the following, it converts acronyms to lower case:
    var str  =  this.rawValue;
    var upCase = str.split(" ");
    for(i=0; i < upCase.length; i++) {
    upCase[i] = upCase[i].substr(0,1).toUpperCase() + upCase[i].substr(1).toLowerCase();
    this.rawValue = upCase.join(' ');

    Thanks for the reply.
    Found the following script in a forum, which works fine as a "custom validation script" in the.pdf version of my form.  However, it will not work in LiveCycle?  The problem seems to be with
    "return str.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g"
    function toTitleCase(str) {
    var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
        return str.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title){
    if (index > 0 && index + match.length !== title.length &&
      match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
    (title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&
    title.charAt(index - 1).search(/[^\s-]/) < 0) {
    return match.toLowerCase();
    if (match.substr(1).search(/[A-Z]|\../) > -1) {
      return match;
      return match.charAt(0).toUpperCase() + match.substr(1);
    event.value = toTitleCase(event.value);

  • It it possible to look for a page that does not contain a string?

    Is it possible in the search feature in Dreamweaver CS3 to find all pages that do NOT contain a specific string?

    I don't think so, at least not directly. I could be wrong, Regular Expressions can be pretty powerful, I'm not sure how well they're implemented in CS3 though: http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt1.edu.html
    Maybe you could do a find/replace of that specific string, with itself.
    All of the files that have it would be updated without actually changing the code.
    The Date Modified for the file would change though.
    The files without the string of info you are looking for would have the old modification date.

  • Looking for a way to find out the x,y coordinates of a string inside a PDF

    Hi!
    I'm looking for a way to find out the x,y coordinates of a string inside a PDF (with free java api's only)
    I got a pdf, and a string to find inside it, what i need to do is to get this string x,y position inside that pdf....
    If any one knows of such, plz let me know...
    Thanx ahead
    Daniel.

    vedmack wrote:
    Hi!
    I'm looking for a way to find out the x,y coordinates of a string inside a PDF (with free java api's only)
    I got a pdf, and a string to find inside it, what i need to do is to get this string x,y position inside that pdf....
    If any one knows of such, plz let me know...
    Thanx ahead
    Daniel.AFAIK, a string of text does not have an (x,y) location inside a PDF file. The location is exists on your screen, and will differ whenever you adjust the resolution of it. Text can have a location when it's stored as an image though, but than it's really the location of a certain number of pixels (not necessarily a string!).

  • How do I write a macro that would look for a string in an entire column

    how do I write a macro that would look for a string in an entire column. If the string is found, it will copy that entire row to a new sheet in that same file?
    I want to look in an entire column lets say "C" for different strings of numbers like 246, 88, 68, 82246 etc... and copy them to a new sheet
    Thanks

    Hello Larbec,
    Try this:
    Option Explicit
    Sub test()
        Dim myNumber As Integer
        Dim myNumbers() As Integer
        Dim i As Integer
        Dim c As Range
        Dim firstAddress As Variant
        myNumbers = Array(246, 88, 68, 82246)
        For i = 0 To UBound(myNumbers)
            myNumber = myNumbers(i)
            With ActiveSheet.Range("C:C")
                Set c = .Find(myNumber, LookIn:=xlValues)
                If Not c Is Nothing Then
                    firstAddress = c.Address
                    Do
        ' Copy c.value to OtherSheet here !!!!
                        Set c = .FindNext(c)
                    Loop While Not c Is Nothing And c.Address <> firstAddress
                End If
            End With
        Next i
    End Sub
    Best regards George

  • Looking for a substring within a string (regexp)

    Hi folks,
    I want to select a substring from a string
    string:
    21;0000;4145054;4;A;4 mit ALU XEOFX,117107,XEOFX YWY,1,YWY
    or
    21;0000;4145054;4;A;4 goldglamsnu XEOFX,198877,XEOFX YWY,1,YWY
    I'm looking for the substring:
    YWY,1,YWY
    and try this SQL statement
    SQL> select REGEXP_substr('21;0000;4145054;4;A;4 mit ALU XEOFX,117107,XEOFX YWY,1,YWY' ,',[^YWY]+[0-9]')
    2 from dual;
    REGEXP_
    ,117107
    I don't know where my mistake is. Can anybody please help me?
    Database Version 11G R2
    Thanks,
    ben
    Edited by: ben512 on May 14, 2013 5:05 PM

    Hi,
    ben512 wrote:
    Hi folks,
    I want to select a substring from a string
    string:
    21;0000;4145054;4;A;4 mit ALU XEOFX,117107,XEOFX YWY,1,YWY
    or
    21;0000;4145054;4;A;4 goldglamsnu XEOFX,198877,XEOFX YWY,1,YWY
    I'm looking for the substring:
    YWY,1,YWYWhy do you want that substring. Do you always want the last 9 characters of the string?
    If you're looking for a substring that starts with 'YWY', and then has any number (including 0) of commas, digits, and additional 'YWY' strings after it, then:
    REGEXP_SUBSTR ( str
               , 'YWY[,[:digit:]]*)
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, maybe 5 or 10 rows), and also post the results you want from that data. Include examples of any special cases you need to handle (e.g., the target pattern is not found at all, or it is found at 2 different places in the string).
    Explain, using specific examples, how you get those results from that data. Say what your business rules are.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Looking for a Mail utility/script to remove older newsletters

    I subscribe to several newsletters from various companies (airlines, hotels, etc) and I'm looking for a utility/script that looks at incoming mail and zaps/displays older mailings since the new message supersedes the older ones. For instance, weekly discount offers come in and I want the previous ones from the same company to be automatically deleted. A confirmation window displaying the candidate messages to be deleted would be a nice feature.
    Does anybody know of such a utility?
    TIA

    well, to catch an email you have to add the email address from the sender or distinctive text, so for simplification purposes you may have to create a rule for each newletter, rather than one rule with lots of text in that field. plus if you create one rule for each, then it is easier to troubleshoot if one newsletter does not get deleted in the way you have specified it.
    glad i could help

  • Java.util.Date deprecated methods, looking for new ones

    Hi,
    I can't find anywhere.
    I'm looking for Date methods, exactly like
    getYear();
    getDay();
    but i don't want them being deprecated.
    I want to get an INT out of a Date (Year, Day, ...)
    please give me a link, name of a fucntion or something.
    Thanks

    Look at the API docs. It says that you have to use the methods in java.util.Calendar instead.

Maybe you are looking for

  • Vendor Invoice verification  payment terms

    Hi Experts, PO is having one item with Gross price,freight . Freight vendor is different from main vendor. Main vendor-PAYMENT TERMS-1% discount- 5 days Freight vendor--PAYMENT TERMS- pay immidiatly After making GRN and when i tried to post invoice i

  • Internal table occurs 0 --------- why obsolate?

    Hi, Can anybody tell why the declaration of internal table occurs 0 and internal table with header line is obsolate now? Explain the adavantages of newer one. is there any performance related issue? Thanks in advance Debjani Lahiri

  • Problem in CIS condtruction Indudtry note apply

    Hi If any one who is involved in applying SAP note for CIS contruction Industry for withholding tax please help me.This may be bit technical. <b>We have applied SAP note 1003730 for new CIS leagal changes in for construction industry.</b> A)Based on

  • JPGS not converting to DNGs

    Hi, When trying to convert JPGs to DNG is it currently failing. Steps: 1. Select the JPG images in Grid view 2. Go to Library, and choose Convert Photo to DNG 3. Untick Only convert RAW files, click OK 4. The conversion starts and the DNG files shows

  • AE can't find a standard plug-in

    I'm trying to use the curves.aex plug-in for my project.  When I drag it to a layer I'm working on, I get one of two errors.  Sometimes I get an "After effects error: invalid filter" error, sometimes I get an error indicating curves.aex could not be