Need help with Update instructions.


Hi all

I am learning XMLDB Berkeley and facing problem to query the XML file that is inserted. I have a small XML file with the following content:



& lt;? XML version = "1.0" standalone = "yes"? & gt;


& lt; Bookshop & gt;


& lt; Book & gt;


& lt; book_ID & gt; 1 & lt; / book_ID & gt;


& lt; title & gt; Harry Potter and the order of the Phoenix & lt; / title & gt;


& lt; subtitles & gt; A photographic history & lt; / subtitle & gt;


& lt; author & gt;


& lt; author_fname & gt; J.K. & lt; / author_fname & gt;


& lt; author_lname & gt; Rowling & lt; / author_lname & gt;


& lt; / author & gt;


& lt; price & gt; 9.99 & lt; / price & gt;


& lt; year_published & gt; 2004 & lt; / year_published & gt;


& lt; Editor & gt; Scholastic, Inc. & lt; / Editor & gt;


& lt; kind & gt; Fiction & lt; / Type & gt;


& lt; quantity_in_stock & gt; 28997 & lt; / quantity_in_stock & gt;


& lt; popularity & gt; 20564 & lt; / popularity & gt;


& lt; / Book & gt;


& lt; / Library & gt;

When I try to update the TITLE of this node, I have the following error message:
---------------------------------------------------------------------------------------------------------------------------
C:\Users\Chandra\Desktop\BDB & gt; javac - classpath. ; "C:\Program Files\Sleepycat software
ware\Berkeley XML DB 2.1.8\jar\dbxml.jar «;» C:\Program Files\Sleepycat Software\B
erkeley XML DB 2.1.8\jar\db.jar' bdb.java
BDB. Java: 75: illegal start of expression
public static final String STATEMENT1 = 'replace the value of the collection of nodes ("twopp."
RO.bdbxml")/bookstore/book/BookID/title with «NEWBOOK" «;»
^
BDB. Java: 80: ")' expected"
System.out.println ("query:" + enonce1);
^
2 errors
---------------------------------------------------------------------------------------------------------------------------

But when I remove the update statements and try to display the TITLE of this node, I see no output. Please help me to make up for my mistakes. Here is the source code that I use to perform this function.

Thank you.

import java.io.File;
to import java.io.FileNotFoundException;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.dbxml.XmlContainer;
import com.sleepycat.dbxml.XmlException;
import com.sleepycat.dbxml.XmlInputStream;
import com.sleepycat.dbxml.XmlManager;
import com.sleepycat.dbxml.XmlUpdateContext;
import com.sleepycat.dbxml.XmlDocument;
import com.sleepycat.dbxml.XmlQueryContext;
import com.sleepycat.dbxml.XmlQueryExpression;
import com.sleepycat.dbxml.XmlResults;
import com.sleepycat.dbxml.XmlValue;

public class bdb {}

Public Shared Sub main (String [] args)
{
Environment myEnv = null;
File envHome = new File ("D:/xmldata");

try {}
EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate (true); If the environment is not
outputs, create it.
envConf.setInitializeCache (true); Turn on the shared memory
region.
envConf.setInitializeLocking (true); Turn the locking subsystem.
envConf.setInitializeLogging (true); Turn on the recording subsystem.
envConf.setTransactional (true); Turn on the transactional
envConf.setRunRecovery (true);
subsystem.
myEnv = new environment (envHome, envConf);
BDB XML work here.
} catch {} (DatabaseException of)
Exception handling goes here
} catch (exception FileNotFoundException fnfe) {}
Exception handling goes here
} {Finally
try {}
If (myEnv! = null) {}
myEnv.close ();
}
} catch {} (DatabaseException of)
Exception handling goes here
}
}

XmlManager myManager = null;
XmlContainer myContainer = null;
The document
String docString = "D:/xmldata/test.xml";
The name of the document.
String docName = "cia."
try {}

myManager = new XmlManager(); Assume that the container doesn't currently exist.
myContainer =
myManager.createContainer ("twoppro.bdbxml");
myManager.setDefaultContainerType (XmlContainer.NodeContainer); A context of update needed to put it.
XmlUpdateContext looking for = myManager.createUpdateContext (); Get the input stream.

XmlInputStream theStream =
myManager.createLocalFileInputStream (docString); Put the real
myContainer.putDocument (docName, / / the name of the document)
theStream, / / the document itself.
Looking for, / / context of the update
(required).
(null); Object XmlDocumentConfig
theStream.delete ();


Update title
public static final String STATEMENT1 = ' * replace the value of the node collection("twoppro.bdbxml")/Bookstore/Book / [bookid = 1] / title with 'NEWBOOK ""; *

XmlQueryContext context = myManager.createQueryContext ();
XmlQueryExpression queryExpression1 = myManager.prepare (STATEMENT1, context);
System.out.println ("try to execute the query:" +)
System.out.println ("query:" + enonce1);
queryExpression1.execute (context);


Get a request context
XmlQueryContext context = myManager.createQueryContext ();

Set the type of Lazy evaluation.
context.setEvaluationType (XmlQueryContext.Lazy);


Declare the query string

Dim queryString As String =
"for $u in collection('twoppro.dbxml')/Bookstore/Book / [bookid = 1].
+ "* return $u/title '; *

Prepare (compile) the query
XmlQueryExpression qe = myManager.prepare (queryString, context);



Results = qe.execute (context) XmlResults;
System.out.println ("OK");
System.out.println (Results);




} catch (XmlException e) {}
Error handling goes here. You may want to check
for XmlException.UNIQUE_ERROR, which is triggered
If a document with this name already exists in
the container. If this exception is thrown,
Try to put it again with a different name, or
Use XmlModify to update the document.
} catch (FileNotFoundException exception) e {}
Generative TODO catch block
e.printStackTrace ();
} {Finally
try {}
If (myContainer! = null) {}
myContainer.close ();
}
If (myManager! = null) {}
myManager.close ();
}
} catch (XmlException this) {}
Exception handling goes here
}
}
}


}

Hello

Please try this (it goes on my shell of dbxml)

public static final String STATEMENT1 = "for $n in collection('twoppro.bdbxml')/Bookstore/Book[book_ID=1]/title return replace value of node $n with 'NEWBOOK'"

Just use "to take care of all the nodes".

Published by: rucong.zhao on February 11, 2009 02:11

Tags: Database

Similar Questions

  • Need help with updates!

    I will start with my features of laptops.

    -System-
    Manufacturer: HP
    Model: HP G62 Notebook PC
    Rating: 4.0
    Processor: AMD Athlon II P320 Dual-Core Processor 2.10 GHz
    RAM: 8.00 GB
    System type: 64-bit Operating System

    So the problem I have is that when I am games I am roughly pushing my computer to its limit and I want to accelerate as efficiently as possible. I recently upgraded my 4.0 GB 8.0 GB RAM, but that's all I've done so far. Keeping in mind the laptop is a bit outdated (I bought in 2010 or 2009). I don't know exactly what the best upgrades are, so why I post here for assistance. I am open to suggestions and advice help my computer!

    I know I should just buy a new computer, but I grew attached to it and I can't really have a desktop computer because I am a student and I need to be moving quite often.

    I would say that my budget is 200 to 400 $ CAD.

    My questions are...

    How can I find out what kind of processor would be best for my computer (if you know it please leave a link or something to show me what would work well)

    The upgrade of the motherboard would also help? (I also don't know what would be useful or compatible)

    TL; DR: I need help to upgrade my laptop and suggestions on what it takes to update and with what would be great!

    Unfortunately there isn't much you can do to make this portable game better. What you need is more powerful graphics and there is no way to get it. There is no better motherboard that you put in it. Ago slightly faster processors, you could install, but the cost would be very important and he would not really game better. Sell your laptop and add it to the CAD $ 400 you have budgeted for upgrades. There are some bargains out there right now on the computers of all kinds, including laptops.

    If you need any help post more come back.

  • Satellite P850-30V - need help with update drivers

    Hello

    Tempo said there are new drivers for NVIDIA and LAN Wi - Fi. I have download extract it the files and they run, BUT the drivers have not been updated and tempo continues to tell me there are updates.

    I play diablo 3 and when I run the game it tells me that my video driver is outdated.

    Help, please

    If everything is working properly you should not install any update, especially not the driver WLAN.
    You have problems with the WIFI connection?

    With the game is a little problem. On mobile units (portable computers) display are preinstalled drivers supported by the laptop manufacturers. The game will be the latest version of the driver from the manufacturer of the graphics card but they don t support drivers for laptops... it's a little complicated.

    My advice to you: If everything works fine and you don t have serious problems disable Tempro.

  • Need help with update statement to be used in the stored procedure

    I have the following update statement and I get "ORA-06512. Someone of you can help me.

    ----
    UPDATE MO X SET X.MOMODEL = (SELECT Y.MOMODEL FROM MO Y WHERE Y.MOID = A_TEMP_INT3)
    WHERE X.MOID in (UPDATE MO X SET X.MOMODEL = (SELECT Y.MOMODEL FROM MO Y WHERE Y.MOID = A_TEMP_INT3)
    WHERE X.MOID in (A_TEMP_INT1, (select assocchild from mo_association
    Connect prior assocchild = assocparent
    Start with assocparent = A_TEMP_INT1)); (by selecting assocchild in mo_association
    Connect prior assocchild = assocparent
    Start with assocparent = A_TEMP_INT1));
    ----

    Note: A_TEMP_INT1 and A_TEMP_INT3 are the values of cursor and is assigned to numeric values in the code.


    Thanks for all the help in advance.

    Kind regards
    REDA
    WHERE X.MOID IN
     (SELECT ASSOCCHILD   FROM MO_ASSOCIATION
          CONNECT BY PRIOR ASSOCCHILD = ASSOCPARENT
         START WITH ASSOCPARENT = A_TEMP_INT1
         UNION
      SELECT A_TEMP_INT1 FROM DUAL );
    

    Should work.
    VR,
    Sudhakar B.

  • Need help with updates of Photoshop CC

    I have Photoshop CC 64-bit running on Windows 7 with Kaspersky and continual problems with upgrades to Photoshop, usually U44M1P7. I've disabled Kaspersky then manually run 13.1.2 and the software says that he has done but Photoshop continues to try to load again the same upgade. Upgrading BRUTE emitted at the same time loaded without any problems. Now the Applications Manager failed during an upgrade and disappeared from my system. Help.

    Hi 32BrianIckenham

    Please visit: http://forums.adobe.com/message/5391508

  • Need help with update of Windows 8

    Can someoneplease tell me how to get the window updates 8 for Acer computer.

    See: http://windows.microsoft.com/en-au/windows/turn-automatic-updating-on-off#turn-automatic-updating-on-off=windows-8

  • need help with update of the applications using the creative cloud

    I get an error: failed to update... impossible to extract the downloaded files...  U44M1I210

    Hi craigdb,

    Please see the Ko: http://helpx.adobe.com/creative-suite/kb/error-u44m1i210-installing-up dates-HYPERLINK .

    Kind regards

    Baudier

  • Need help with an instruction box with the data in the collection

    It is located in the section source on my interactive form, my collection process works, but there is "-" where there should be a "$0.00 ' in the summary section.

    There is a problem with my syntax of the case statement,


    Select pending, records c002 c001, c003 case $ if no then ' $0.00 ' if not no c003 end other "$0.00 ' from apex_collections where collection_name ="Summary1»»"

    Hi Doug,.

    The best way to handle this is with the NVL function, for example,

    SELECT c001 Awaiting, c002 Records, NVL(c003,0) Dollars ...
    

    and let the application manage the formatting of the field (which I suppose it's done for non-null values).

    However, if you want to use the CASE statement, here is how it works:

    SELECT CASE WHEN c003 IS NULL THEN 0 ELSE c003 END Dollars ...
    

    -Jennifer

  • [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an auto update that's simple to install, just get this error every time

    [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an automatic update that's simple to install, just get this error at each time HHHHEEEELLLPPPPP! Thank you

    I had the same problem.  But finally found a solution.  If your listing is similar to mine, then keep.  XP Media Center Edition 2005 (sp2).  AMD Athlon 64 x 2 Dual-Core, HP a1630n desktop computer.

    Go to the HP website, search for sp37394-XP sp3 Upgrade utility Microsoft for systems equipped with AMD processors.

    I had the same 0 x 80240036, 0x8024400a error, but realize my problem was really get manually downloaded sp3 and installed without continue loop crashing and not error messages.

  • need help with windows update C8000F1A error code

    I need help with an error code that is given to my PC when I try to put up-to-date

    Hello

    1. don't you make recent changes?

    2. This does happen with any special updates or all updates?

    I suggest you to follow these steps and check if that helps:

    Method 1:

    If you have installed a security software on the computer, then I suggest you try to disable temporary and check to see if the same problem happens. Make sure that you enable security software back once the diagnosis is made to prevent the computer from virus attacks.
    http://Windows.Microsoft.com/en-us/Windows-Vista/disable-antivirus-software

    Method 2:
    I suggest you follow the steps in the link below and check if it helps:
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-installing-updates

    It will be useful.

  • Need help with windows 10 update

    I don't have this icon on my desktop so I can not to update or windows 10 reserve

    need help with this, I want to experience windows 10!

    I need a quick answer, I tried to find a way to book and I can't do anything

    Try this tool to upgrade your system: http://windows.microsoft.com/en-us/windows-10/media-creation-tool-install

  • Hi, I need help with installing updates for CS5

    Hi, I need help with the installation of the updates of CS5. I get the following message: some updates to installation failure. My product is already registered. Can someone help me, please?

    Erkan please download and apply updates directly from updates.

  • MAC OS 10.6.8 using Safari 5.1 need help with Adobe Flash update

    Hello-

    Recently, Adobe Flash installed an icon in my system preferences and when I click the icon it has several tabs.  It allows updates automatically check.  It is said it will install the latest version of Flash without having to remove the previous version, but I've never said that a newer version is available, unless I have click "check now".  Although "Check updates automatically" is checked, I don't know where he tells me a newer version is available.  In addition, there was 5 "new versions" available since this icon has been installed in the system Prefeences, I only found on newer versions when I clicked on "check now".  If I read that with this new way to install the Mac final version of Flash requires not me to uninstall the previous version of Flash how we installed the latest version of Flash?  Is it in an email?

    Because it tells me that there is a newer version of Flash unless I click on "Check now" must still do the way I used to install the latest version of flash?  (The path in front of this icon was added to the system preferences)?

    I would appreciate help with update Flash to the latest version.  I used to uninstall the old version, restart the browser and download the latest version and install it.  He always worked find, but that was before there was an Adobe icon in my system preferences.

    Here are the instructions to uninstall and install the Flash drive on Mac:

    Uninstall Flash Player | Mac OS

    Setup instructions for Mac OS

    This link will give you updates for the two betas and release version updates.  In fact, whenever we update the player you should be notified.

    Thank you

    Chris

  • I'm suddenly needing help with my browser Firefox (6.0.2)

    Hello
    I'm suddenly needing help with my browser Firefox (6.0.2)

    (OS: I use Windows XP).

    When I open the browser, I don't see is a totally white screen of white, with all the toolbars at the top.

    I know that my physical connections are very good: I have tested the modem, turned the pc market etc and I can also receive/send emails.

    This problem started today, September 8, 2011 and has never happened before.

    Is it a coincidence that Firefox itself to day before I disconnected yesterday evening? Could this be something to do with this particular new update?

    I also noticed that just before I "opened" Firefox, I now get a small box indicating:

    [JAVASCRIPT APPLICATION]
    Handl exc in Ev: TypeError: this oRoot.enable is not a function

    This never appeared before - I hope that it offers a clue has what is wrong.

    The browser not be stuck in Mode safe, said by the way.

    Of course, I can't find solutions to the problem on the internet, I don't physically see all Web sites!
    (A friend sends this request in my name from their pc)

    Any light you can throw on this problem of confusion would be much appreciated. I'd rather not have to uninstall and reinstall Firefox if possible.

    If the only option is to uninstall Firefox and reinstall from your site, I'm also in trouble (I can not see the internet or download).
    In this case, would you be able to send the .exe file as an attachment to my e-mail address? In the affirmative, please let me know and I'll give you more details.

    Thanks in advance.

    One possible cause is security software (firewall) that blocks or limits Firefox or plugin-container process without informing you, possibly after the detection of changes (update) for the Firefox program.

    Delete all rules for Firefox in the list of permissions in the firewall and leave your firewall again ask permission to get full unlimited access to the internet for Firefox and the plugin-container and the update process.

    See:

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • I need help with an installation failure to interpret and troubleshoot a Setup log.

    Background: A few years ago, many editors of cinema used Final Cut Pro 6 (also contained in Final Cut Studio 2) for their editing projects.  Shared Apple Final Cut X uses a different format that is not compatible with FCP6.  Sometimes, these editors are called to work on a few historical projects that have been published in FCP6 and need this version to run now.

    Starting with OS X Lion, FCP6 would install not in Lion and thereafter.

    According research by Jeremy Johnston as noted on his blog, he discovered that Apple has inserted a file in the folder CoreServices in the Library folder of the system folder that causes versions the version Final Cut Pro X (and other older Apple programs in the same situation) do not settle.  He suggested changes to this file that would seek to prevent interfering with the installation of FCP6 in Lion, many users of final cut PRO 6 were successful in their efforts to install in Lion and work with it.

    Later in a discussion update on installing FCP6 in Mavericks, HawaiianHippie determined that the simplest way to perform the installation of FCP6 was simply copy this file and remove it from the system folder, install FCP6 and then restore the copied file:

    https://discussions.Apple.com/message/26309669#26309669

    I used this method with success to install FCS2 in Yosemite:

    [click on images to enlarge]

    However, in my attempts to install FCS2 in El Capitan, it fails in the last 5% to install the first DVD:

    First of all, I need advice on how to display an extremely large Setup log in this thread (on MacRumors, it is a method to insert a 'code' in a small box that can be the object of a scrollbar if necessary to read all along).  I am unable to find such a method to post here.

    Then once approved, I need help to determine which component is causing the installation to fail and perhaps this element can be omitted from the installation:

    If this element is not required, then maybe FCP6 can be installed successfully without it.  And if that omitted element is necessary, perhaps a manual method to install it can be determined by pacifists.

    It is my goal to help those who need to install and use FCP6 on their new Macs running El Capitan.

    Here is the post on MacRumors with pre-installed Setup log:

    http://forums.MacRumors.com/threads/i-need-help-with-an-installation-failure-to-interpret-and-troubleshoot-an-Installer-log.1954786/#post-22541389

Maybe you are looking for

  • How can I download a stand-alone copy so I can install on the web?

    I need to be able to do the installation on a Win 7 Desktop on a closed network.

  • Satellite A300-15J - picture freezes on external monitor

    Hey there,I have some problem with ATI 3470HD. recently I bought the TV Samsung 2333HD LCD, when I connect it with Notepad (as the main and only monitor) in some images of minutes simply to freezes and goes black for a few seconds. It's like graphics

  • Satellite Pro L20 - need to re - install

    Hiya, I have a client who owns many Toshiba laptops, but I have a problem with is the L20, which is the last Tosh they have. Anyway, the end user has a viral infections 4958 stggering on his machine and the machine was not happy. They have been sanit

  • PXI-6120 HAVE values only show the low limit values

    Hello, I use a PXI-6120 with traditional DAQ driver module screws switch a signal of AI to a PFI channel that allows synchronization of area of OCCUPANCY the AI. In order to measure a single channel of AI with the same set-up, I stopped the criterion

  • Windows 10 could be damaged my GTX 680 M

    Hi all First of all I would like to say that I am writing this post after a long time (3-4 months) research and no not tried to solve my problem. My Alienware M17x-R4 gives errors "display driver stopped responding and has recovered." everything at s