BDB XML + PHP, some questions

Hello, nice to be there...
I've got some questions...
Now, im writing application in PHP and using the Berkeley DB XML.
I wrote some code, but i cant find the documentation to using Berkeley DB XML in PHP.
My code are look that, some comments to understanting...
<?php
// Version of BDBXML
print(dbxml_version());
echo "<br/>";
$con_name="container.dbdbxml";
// Initialize XmlManager
$mgr = new XmlManager();
if($mgr->existsContainer($con_name)) $mgr->removeContainer($con_name);
* Container location: C:/Documents and Settings/UserName/
$con = $mgr->createContainer($con_name);
// Opening container
$mgr->openContainer($con_name);
// Adding XML documents
$con->putDocument(1, "<base><element1>String text</element1><element2>Integer</element2></base>");
$con->putDocument(2, "<base><element1>String text 2</element1><element2>Integer 2</element2></base>");
// Iteriation adding documents
$iter = 3;
for($i=0;$i<20;$i++) {
$con->putDocument($iter, "<base><element1>String text ".$iter."</element1><element2>Integer ".$iter."</element2></base>");
++$iter;
// Documents the container
$res = $con->getAllDocuments();
$res->reset();
// Couting the elements
$count = $con->getNumDocuments(); echo "Numbers of count - documents: ".$count."<br/>";
// Listing the resultset using getAllDocuments
while($res->hasNext()) {
$value = $res->next();
$doc = $value->asDocument();
print $doc->getName()." = ".$value->asString()."<br/>";
// Listing the result set using query,
$qc = $mgr->createQueryContext();
$qc->setDefaultCollection($con_name);
$query="collection(\"container.dbdbxml\")";
$res2 = $mgr->query($query);
// Size of result set
$size = $res2->size(); echo "Size of resultset: ".$size."<br/>";
$res2->reset();
while($res2->hasNext()) {
$value = $res2->next();
$doc = $value->asDocument();
print $doc->getName()." = ".$value->asString()."<br/>";
?>
Now, I want to know those things:
*1. Can I create the Container which autoincrement names the files? Example: putDocuments(AutoIncrementname,FileDocument);*
Can I increment that in the container?
*2. How I can create relation with containers?*
For example:
Container1 -> Document1 [  <xml id="1"><name>Something</name></xml>  ]
Container2 -> ExtraDocument1 [ <base> <id>1</id> <names>Pre Name</names><relation> *" Here is relation to Container1 @ id "* </relation></base> ]
*3. Where I can find the classes for using in PHP?*
Thank You for answers and Really Sorry For My Bad English!
Edited by: user12232307 on 2010-02-11 10:32

Hi,
I'm not using PHP, but probably some ideas would be helpful:
1) In Java there is a XmlDocumentConfig class and its method setGenerateName(boolean). If you set it to true and provide a XmlDocumentConfig object to a putDocument() method, then DB XML will generate names for you with default prefix 'dbxml_' and the incremental numeric id (if I remember correctly), but the incremental numeric id is not guaranteed by DB XML, only that the document name will be an unique value (at least according to the documentation). You can change this prefix by providing a name of XmlDocument object that you are trying to put. Then the final name of a document will be "<your_doc_name>_id".
2) It depends what you mean by relation? Why don't just use the name of a container?
3) All that I was able to find by quick googling is http://www.oracle.com/technology/products/berkeley-db/pdf/building-php-applications-with-db-xml.pdf
Vyacheslav

Similar Messages

  • Some questions on xml db content connector

    As we know, Oracle XML DB Content Connector implements JSR-170 in XML DB 11g.
    After reading the related document about XML DB Content Connector, I have some questions as follows.
    1. Is XML DB Content Connector API available only for XML DB 11g? or can be used in xml db 10g?
    2.The document said "You can find additional sample code in the following location:
    $ORACLE_HOME/xdk/demo/jcr",
    and where can I get the sample code if I haven't install oracle 11g?
    Thanks

    Please contact me at : [email protected] for further discussion.

  • Miscellanous questions about BDB XML

    Hi !
    I'm in search for a storage solution for a Matlab app that manipulates big volumes of datas (several Gb), and so can't load them fully in memory without crashing. I also can't load / unload them each time I need a bit of these data, since it is rather long to load a file in memory (about 0.12s). So I was thinking about using a DMB like BDB XML, and I have a few questions about it :
    <ul><li>What about performances to create a 3-5Gb database in a single batch ?</li>
    <li>What about performances to excecute a XQuery request on a db this large ? Longer or shorter than loadin directly the file in memory ? With an index or without ?
    </li>
    <li> No matlab integration is provided, so I have to way : use Matlab C integration to make an interface to use BDB XML, or using the shell via an exec like command to interact with BDB ? Is the shell trick performant ? Or does it spend a lot of time parsing the input ?</li>
    </ul>
    Thanks for those who will take a bit of their precious time to answer my questions !

    Hello,
    I'm in search for a storage solution for a Matlab app that manipulates big volumes of datas (several Gb), and so can't load them fully in memory without crashing. I also can't load / unload them each time I need a bit of these data, since it is rather long to load a file in memory (about 0.12s). So I was thinking about using a DMB like BDB XML, and I have a few questions about it :
    <ul><li>What about performances to create a 3-5Gb database in a single batch ?</li>It will take a while. If you bulk load you should avoid using transactions and sync/exit the environment when you are done. Note that you should determine what indexes you might want/need before doing the load and create them. Reindexing 5GB of data will take another really large chunk of time. I recommend experimentation with indexes, queries and a small representative subset of the data.
    Be sure to create a node storage container with nodes indexed.
    Is this one document or many? Many is better. One 5Gb document is less than ideal but will work.
    <li>What about performances to excecute a XQuery request on a db this large ? Longer or shorter than loadin directly the file in memory ? With an index or without ?You really need indexes. The query will likely succeed without indexes but depending on the query and the data could take a very long time. See above on experimentation first.
    </li>
    <li> No matlab integration is provided, so I have to way : use Matlab C integration to make an interface to use BDB XML, or using the shell via an exec like command to interact with BDB ? Is the shell trick performant ? Or does it spend a lot of time parsing the input ?</li>There is no C interface, just C++. I would not recommend using the dbxml shell for this although you could if you really need to.
    Let the group know how this turns out.
    Regards,
    George

  • Some doubt about Bdb XML Normal Recovery

    Hi, everyone
    I have read the document Getting Started with Transaction Processing for Java shipped with Bdb XML 2.4.13. In the book, there is something about Normal Recovery:
    Normal recovery is run only against those log files created since the time of your last checkpoint.To test this, I have designed a scenario as below:
    The ENVIRONMENT directory is under E:/bdb-xml/environment, and the BACKUP directory is under E:/bdb-xml/backup, the CONTAINER name is entry.dbxml, and there is already a document 1.xml in this container.
    1. run db_recover against ENVIRONMENT.
    2. copy entry.dbxml to BACKUP.
    3. create a document 2.xml.
    4. run checkpoint against ENVIRONMENT.
    5. modify document 1.xml.
    6. run checkpoint against ENVIRONMENT.
    7. copy log.0000000001(there is only one log file in ENVIRONMENT) to BACKUP, Note that I didn't copy the entry.dbxml in ENVIRONMENT.
    8. run db_recover agaist BACKUP(now there are 2 files : entry.dbxml, log.log.0000000001).After that, I used the BACKUP as environment directory, and try to query 2.xml. And I retrieved the document correctly, which I feel very curious. As the document says, the last checkpoint is created by step 6, after that, there is no other modifications happens, so the modification happened at step 3 and step 5 will not take effect when db_recover executed. But the two changes have committed to entry.dbxml.
    So, which is the last checkpoint. And what is the those log files created since the time of your last checkpoint.
    I also want to know where the checkpoint be writen, in the db files or the log files.
    thanks advance.
    Regards,
    John Kao.

    Jhon,
    You really do want to know the gory details don't you? :-)
    Running recovery in your backup directory will cause the container there to pick up all changes from the log file that it does not yet have. The checkpoint on the original container doesn't mean anything to the backup container.
    Let me point you to even more interesting documentation that is in the Berkeley DB documentation set. This page has all of the BDB documentation, including links that are not included in the BDB XML doc:
    http://www.oracle.com/technology/documentation/berkeley-db/db/index.html
    The "Getting Started with Transaction Processing" documents on that page have the sort of information you seem to want.
    Regards,
    George

  • How to install BDB XML on shared server?

    Hi All,
    1. I want to install BDB XML on a shared server (bluehost). Can anyone suggest me how to do it? Since I dont have enough permissions, some of the 'php shared extensions' are not being installed. I get warning like-
    Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/
    cp: cannot create regular file `/usr/lib/php/extensions/no-debug-non-zts-20060613/#INST@343#': Permission denied
    make: *** [install-modules] Error 1
    2. Also, how can I add new libraries to library path? (Again no permission)
    Any help on these issues would be highly appreciated,
    Thanking you in anticipation.

    I'm talking about Berkeley DB XML, just in case it was not clear.

  • Installing BDB XML and including it into a java application

    Hi there :)
    I'm new to BDB XML and I've got some questions about it :
    1/ The documentation says about BDB XML that it is based on BDB. Does it mean that I need to install the standard BDB first to use BDB XML ? (I'm pretty sure I don't have to but I would like a confirmation =))
    2/ I want to developp a web application which will use BDB XML. The documentation says I need to add some jars into my project to use it but do I need to install it on my computer (Windows XP) first ? (with the .msi file ?)
    3/ Where will the xml files be physically stored after I add them into the database ? (what is the default database folder on the hard disk ?)
    Thank you for you help :)
    Regards,
    Gary

    Hi Gary,
    1) You need to install only DB XML. BDB is bundled with DB XML, so you don't have to worry.
    2) Yes, you need to add two jars: db.jar and dbxml.jar. But these jars depend on native DB XML libraries, so you will have to install DB XML anyway: only jars wouldn't be sufficient. Moreover, I would recommend to install DB XML from sources providing the --enable-java+ flag to the buildall.sh script
    3) All XML files will be stored in a container or containers (depending on how many of those you will decide to utilize in your application). It is up to you where you are going to reside DB XML environment/containers -- DB XML is quite low-level XML-database.
    Hope this helps,
    Vyacheslav

  • Correct installation of BDB XML on Mac OS X, and use with XCode

    I downloaded the tarball, compiled the whole thing without a problem, and then copied the contents of the install directory to /usr/ (trying to change the prefix on the configure script stopped it from compiling, for some reason) because I didn't want to add stuff to my path (and the contents looked like they belonged in /usr anyway)
    But now I'm not sure how to get XCode to find the search paths and libraries. Does anyone who has a working installation of BDB XML on mac os feel like giving me some pointers as to how they did it?
    Thanks,
    Daniel Peebles

    I don't know the exact answer to your question, but you can probably figure it out on your own like:
    1) Create a File object that represents an existing file. Play around with the path until the file can be found.
    2) Now that you have a File object representing a valid, existing path, use MyFile.getAbsolutePath() to see what the full path string is. MyFile.getCanonicalPath() might provide some answers as well.
    Whatever getAbsolutePath() returns is the correct format for the file path string.

  • BDB XML DOM Implementation

    Hi all---
    I have some newbie questions about BDB/XML's DOM Implementation and its interaction with Xerces-c.
    We are trying to deploy BDB/XML underneath our current database abstraction layer. The application makes use of Xerces-c and the abstraction layer query/get interfaces return objects of type Xercesc-XXXX::DOMDocument*. I can easily get documents out of BDB/XML and return the DOM to the upper layer by use of the XmlDocument::getContentAsDOM() interface.
    The problem occurs as the upper application layers start to manipulate the Document. For instance, in order to print the document, some code creates a serializer (DOMWriter) using Xerces-c, but when applied to the Document returned by BDB/XML the serializer corrupts the DOM and we get an ugly crash.
    I'm completely new to the intricacies/compatibility issues between DOM implementations---is what I am describing here supported in theory? Or is there a fundamental problem---some incompatibility between a Xerces-c DOMWriter and a BDB/XML DOMDocument?
    fwiw, the error appears to be caused by the Xerces-c memory manager which apparantly has no idea about pages being used by BDB, and is allocating structures on top of BDB objects.
    Any ideas? Advice where to investigate?
    thanks,
    SF

    Steve,
    First, the Xerces-C DOM implementation in BDB XML is not entirely complete, and is mostly read-only from an application perspective. So if you are doing anything to modify the returned DOM you run some risk. It's implemented using Xerces-C 2.7.
    Second, the availability of the Xerces-C DOM in BDB XML has a limited lifetime. It will almost certainly not be availble in the next release of BDB XML, so it's not something you should rely on. You may be best off serializing your results and if you want to manipulate them using Xerces, re-parse it into a DOM implementation that you control. I realize there is loss of efficiency in doing this.
    In our next release there are changes being made (for very good reasons) that make it impossible to maintain the XmlDocument::getContentAsDOM() interface. If we did keep it, we'd just be serializing and re-parsing anyway.
    Regards,
    George

  • I have some questions regarding setting up a software RAID 0 on a Mac Pro

    I have some questions regarding setting up a software RAID 0 on a Mac pro (early 2009).
    These questions might seem stupid to many of you, but, as my last, in fact my one and only, computer before the Mac Pro was a IICX/4/80 running System 7.5, I am a complete novice regarding this particular matter.
    A few days ago I installed a WD3000HLFS VelociRaptor 300GB in bay 1, and moved the original 640GB HD to bay 2. I now have 2 bootable internal drives, and currently I am using the VR300 as my startup disk. Instead of cloning from the original drive, I have reinstalled the Mac OS, and all my applications & software onto the VR300. Everything is backed up onto a WD SE II 2TB external drive, using Time Machine. The original 640GB has an eDrive partition, which was created some time ago using TechTool Pro 5.
    The system will be used primarily for photo editing, digital imaging, and to produce colour prints up to A2 size. Some of the image files, from scanned imports of film negatives & transparencies, will be 40MB or larger. Next year I hope to buy a high resolution full frame digital SLR, which will also generate large files.
    Currently I am using Apple's bundled iPhoto, Aperture 2, Photoshop Elements 8, Silverfast Ai, ColorMunki Photo, EZcolor and other applications/software. I will also be using Photoshop CS5, when it becomes available, and I will probably change over to Lightroom 3, which is currently in Beta, because I have had problems with Aperture, which, until recent upgrades (HD, RAM & graphics card) to my system, would not even load images for print. All I had was a blank preview page, and a constant, frozen "loading" message - the symbol underneath remained static, instead of revolving!
    It is now possible to print images from within Aperture 2, but I am not happy with the colour fidelity, whereas it is possible to produce excellent, natural colour prints using its "minnow" sibling, iPhoto!
    My intention is to buy another 3 VR300s to form a 4 drive Raid 0 array for optimum performance, and to store the original 640GB drive as an emergency bootable back-up. I would have ordered the additional VR300s already, but for the fact that there appears to have been a run on them, and currently they are out of stock at all, but the more expensive, UK resellers.
    I should be most grateful to receive advice regarding the following questions:
    QUESTION 1:
    I have had a look at the RAID setting up facility in Disk Utility and it states: "To create a RAID set, drag disks or partitions into the list below".
    If I install another 3 VR300s, can I drag all 4 of them into the "list below" box, without any risk of losing everything I have already installed on the existing VR300?
    Or would I have to reinstall the OS, applications and software again?
    I mention this, because one of the applications, Personal accountz, has a label on its CD wallet stating that the Licence Key can only be used once, and I have already used it when I installed it on the existing VR300.
    QUESTION 2:
    I understand that the failure of just one drive will result in all the data in a Raid 0 array being lost.
    Does this mean that I would not be able to boot up from the 4 drive array in that scenario?
    Even so, it would be worth the risk to gain the optimum performance provide by Raid 0 over the other RAID setup options, and, in addition to the SE II, I will probably back up all my image files onto a portable drive as an additional precaution.
    QUESTION 3:
    Is it possible to create an eDrive partition, using TechTool Pro 5, on the VR300 in bay !?
    Or would this not be of any use anyway, in the event of a single drive failure?
    QUESTION 4:
    Would there be a significant increase in performance using a 4 x VR300 drive RAID 0 array, compared to only 2 or 3 drives?
    QUESTION 5:
    If I used a 3 x VR300 RAID 0 array, and installed either a cloned VR300 or the original 640GB HD in bay 4, and I left the Startup Disk in System Preferences unlocked, would the system boot up automatically from the 4th. drive in the event of a single drive failure in the 3 drive RAID 0 array which had been selected for startup?
    Apologies if these seem stupid questions, but I am trying to determine the best option without foregoing optimum performance.

    Well said.
    Steps to set up RAID
    Setting up a RAID array in Mac OS X is part of the installation process. This procedure assumes that you have already installed Mac OS 10.1 and the hard drive subsystem (two hard drives and a PCI controller card, for example) that RAID will be implemented on. Follow these steps:
    1. Open Disk Utility (/Applications/Utilities).
    2. When the disks appear in the pane on the left, select the disks you wish to be in the array and drag them to the disk panel.
    3. Choose Stripe or Mirror from the RAID Scheme pop-up menu.
    4. Name the RAID set.
    5. Choose a volume format. The size of the array will be automatically determined based on what you selected.
    6. Click Create.
    Recovering from a hard drive failure on a mirrored array
    1. Open Disk Utility in (/Applications/Utilities).
    2. Click the RAID tab. If an issue has occurred, a dialog box will appear that describes it.
    3. If an issue with the disk is indicated, click Rebuild.
    4. If Rebuild does not work, shut down the computer and replace the damaged hard disk.
    5. Repeat steps 1 and 2.
    6. Drag the icon of the new disk on top of that of the removed disk.
    7. Click Rebuild.
    http://support.apple.com/kb/HT2559
    Drive A + B = VOLUME ONE
    Drive C + D = VOLUME TWO
    What you put on those volumes is of course up to you and easy to do.
    A system really only needs to be backed up "as needed" like before you add or update or install anything.
    /Users can be backed up hourly, daily, weekly schedule
    Media files as needed.
    Things that hurt performance:
    Page outs
    Spotlight - disable this for boot drive and 'scratch'
    SCRATCH: Temporary space; erased between projects and steps.
    http://en.wikipedia.org/wiki/StandardRAIDlevels
    (normally I'd link to Wikipedia but I can't load right now)
    Disk drives are the slowest component, so tackling that has always made sense. Easy way to make a difference. More RAM only if it will be of value and used. Same with more/faster processors, or graphic card.
    To help understand and configure your 2009 Nehalem Mac Pro:
    http://arstechnica.com/apple/reviews/2009/04/266ghz-8-core-mac-pro-review.ars/1
    http://macperformanceguide.com/
    http://www.macgurus.com/guides/storageaccelguide.php
    http://www.macintouch.com/readerreports/harddrives/index.html
    http://macperformanceguide.com/OptimizingPhotoshop-Configuration.html
    http://kb2.adobe.com/cps/404/kb404440.html

  • Some Questions on Adobe PDF Forms

    Hi,
    I have some questions on Adobe Forms development (especially Adobe Forms in ABAP)
    1)     In a form interface, in the Code Initialization can we use Object Oriented Syntaxes such as class method calls, etc?
    2)     Can we declare Global Data variables with reference to Class References / Interfaces
    3)     Can we use the latest ECC 6.0 enhancement framework to add code in the standard form interface to enhance / enrich some logic within the form? This is to avoid copying the form interface into a Z in order to enrich the form via coding?
    Please let me know if this is possible at all and how
    Will award points
    Thanking You in advance
    Regards,
    Aditya

    That is possible of course. You should use the PDFObject API for that requirements.
    1. define a xml schema with all data given by SAP system.
    2. create a form template which uses this schema as data connection
    3. implement a java application (i.e. J2EE application) which:
    - gets the data from SAP system and generates some pdf files (using PDFObject API)
    - reads pdf files back to xml and submits the data to a BAPI
    Regards
    Sebastian

  • Some questions on versioning and synchronizing metadata

    Hy all!
    I am quite new to warehousing and Oracle Warehouse Builder, and so i would have some questions regarding on some common issues. I would appriciate if you guys would who have experience in this domain to share some good practice knowledge :)
    I am using OWB 10.2
    So first of all i would like to know if you have some proposal of the way of versioning control and synchronizing projects between team memebers when working on a bigger project, team memebers that don't work on the same repository (cause i saw that OWB has an integrated multiuser support for handeling object locks and user sessions).
    I saw that a way of migrating data from one place to a nother is using the import/export options integrated in OWB. This creates mdl files wich are some kind of "dumps" of the metadata informations, but the thing with these mdl files wich i don't think is a good way to synchronize is that first of all the .mdx and .xml files contained in the .mdl (wich is kind of a zip) contains many informations in it (like creation date, some timestamps, etc) wich are always updated when exporting, and if synchronizing these files maybee using CVS, we always will get differences between the files alltough they would contain the same thing, only timestamps changed.
    Then a nother issue with this, is that we could have 2 alternatives: dump the whole project, wich is odd to have to synchronize a single file between users, especialy on a big project, then the orher way would be doing for each object from the project (each mapping, each table, etc) an separate .mdl filem then to synchronize each file of each object, wich will be unefficient on reimporting each file in part.
    So please if you can share the way you work on a big project with many implementers with OWB, i would really appriciate.
    A nother thing i would like to know is: is there a way to generate from an existing project (like one created with OWB) the OMB commands dump (maybee in a tcl script)? Cause i saw that the way the exeprienced users implement warehousing is using TCL with OMB language. I downloaded the example from oracle for warehouse project, and i saw that is entirely made from tcl scripts (so no mdl file involved). And this i think would be nice, to have the OMB commands generated from an existing projects.
    I see this OWB projects like a database wich can be built up from only OMB commands and OWB a graphical tool to do this (same as constructing a database only from DDL commands or using SQL developer to do this), this is why i am asking about a way of dumping the OMB commands for creating an OWB project.
    Please give me some advices, and correct me if i sad some dumb things :D but i really am new to warehousing and i would really appriciate if you guys with experience could share some informations.
    Thank you verry much!
    Alex21

    Depends. Having everyone working on the same project certainly simplifies things a lot regarding merging and is generally my preference. But I also recognize that some projects are complex enough that people wind up stepping on each other's toes if this is the case. In those cases, though, I try to minimize the issue of merging changes by having common structural objects (code libraries, tables, views, etc) retained in a single, strictly controlled, central project schema and having the developer's personal work areas reference them by synonym, thus being unable to alter them to the detriment of others.
    If they want to change a common object then need to drop their synonym and make a local copy which they can alter, and then there is a managed process by which these get merged back into the main project schema.
    This way any changes MUST go through a central schema, we can put processes in place to notify all of the team of any impending changes, and can also script updates across the team.
    Every hour a script runs automatically that checks for dropped synonyms and notifies the project leader. It especially checks for two developers who have built local copies of the same object and notifies each that they need to coordinate with each other as they are risking a conflict. When a structural change is submitted back to the central shared schema, it is added to a batch that is installed at end of business and a list of those impending changes is circulated to the team along with impact analysis for dependencies. The install script updates the main schema, then also drops the local copy of the object in the developer's schema who made the change and re-establishes the synonym there to get back to status quo for the change monitoring. Finally, it then updates itself in all of the developer areas via OMBPlus. So, each morning the developers return to an updated and synched environment as far as the underlying structure.
    This takes care of merging structural issues, and the management of the team should minimize other metadata merging by managing the worklist of who is to be working on a given mapping or process flow at a given time. Anyone found to be doing extraneous changes to a mapping or process flow when it is not in their job queue without getting pre-approval will be spoken to VERY firmly as this is counter to policy. And yes, OWB objects such as mappings are then also coordinated to the central project via import/export. OMBplus scripts also propogate these changes daily across the team as well.
    Yep, there is a whole lot of scripting involved to get set up.... but it saves a ton of time merging things and solvinv conflicts down the road.
    Cheers,
    Mike

  • Some questions on whitespace and &

    Dear all,
    I have some questions on whitespace and & that need you kind help:
    1. Except /n /t /r and space, is there any characters that are whiteSpace characters?
    2. When parsing XML document, when the ignorableWhitespace() method is called? Will it be called from characters() ?
    e.g. Where the white space after <a> is called, and where is the white space between test1 and test 2 indied <b> is called?
    <a>
       <b>test1 test2</b>
    </a>  3. When the & should be escaped in a well-formed (or validated) XML file by replacing &?
    It should be excaped in any element content, such as <b>test1 & test2< /b> - except for <![CDATA[ section?
    It should NOT always be used in attributes? e.g. <a b="test1 & test2"/>  - has to do escaped by entity & - am I right?
    Thanks!
    Thanks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks DrClap.
    >
    2. When parsing XML document, when the
    ignorableWhitespace() method is called? Will it be
    called from characters() ?It will be called when the document has a DTD and the
    parser is a validating one that is actually
    validating, when the parser sees whitespace that is
    not part of a DTD element. It will not be called from
    characters() because that is a method that you write.I wrote a contentHandler and using Xerces parser to parse an XML document. When I set validating feature to false, I found that for:
    <a>
       <b>test1 test2</b></a>The white space between <a> and <b> (including newline) is actually called from characters(), not in ignorableWhitespace(). So does this mean that if validating - white space is always called from ignorableWhitespace(), and if not validating, if it is always called from characters()?
    >
    3. When the & should be escaped in a well-formed(or
    validated) XML file by replacing &? The XML Recommendation says "The ampersand character
    (&) and the left angle bracket (<) may appear
    in their literal form only when used as markup
    delimiters, or within a comment, a processing
    instruction, or a CDATA section. If they are needed
    elsewhere, they must be escaped using either numeric
    character references or the strings "&" and
    "<" respectively."So in this sense, both & in <b>test1 & test2< /b> and <a b="test1 & test2"/> is illegal unless replacing them by & - right? What does the markup delimiters mena in above XML Recommendation ? Example?
    Thanks!

  • [CS5.5/6] - XML / Data Merge questions & Best practice.

    Fellow Countrymen (and women),
    I work as a graphic designer for a large outlet chain retailer which is constantly growing our base of centers.  This growth has brought a workload that used to be manageable with but two people to a never ending sprint with five.  Much of what we do is print, which is not my forte, but is also generally a disorganized, ad-hoc affair into which I am wading to try to help reduce overall strain.
    Upon picking up InDesign I noted the power of the simple Data Merge function and have added it to our repetoire in mass merging data sources.  There are some critical failures I see in this as a tool going forward for our purposes, however:
    1) Data Merge cannot handle information stored and categorized in a singular column well.  As an example we have centers in many cities, and each center has its own list of specific stores.  Data merge cannot handle a single column, or even multiple column list of these stores very easily and has forced us into some manual operations to concatenate the data into one cell and then, using delimiter characters, find and replace hard returns to seperate them.
    2) Data Merge offers no method of alternate alignment of data, or selection by ranges.  That is to say:  I cannot tell Data merge to start at Cell1 in one column, and in another column select say... Cell 42 as the starting point.
    3) Data merge only accepts data organized in a very specific, and generally inflexible pattern.
    These are just a few limitations.
    ON TO MY ACTUAL DILEMMA aka Convert to XML or not?
    Recently my coworker has suggested we move toward using XML as a repository / delivery system that helps us quickly get data from our SQL database into a usable form in InDesign. 
    I've watched some tutorials on Lynda.com and havent yet seen a clear answer to a very simple question:
    "Can XML help to 'merge' large, dynamic, data sets like a list of 200 stores per center over 40 centers based off of a single template file?"
    What I've seen is that I would need to manually duplicate pages, linking the correct XML entry as I go rather than the program generating a set of merged pages like that from Data Merge with very little effort on my part.  Perhaps setting up a master page would allow for easy drag and drop fields for my XML data?
    I'm not an idiot, I'm simply green with this -- and it's kind of scary because I genuinely want us to proceed forward with the most flexible, reliable, trainable and sustainable solution.  A tall order, I know.  Correct me if I'm wrong, but XML is that beast, no?
    Formatting the XML
    Currently I'm afraid our XML feed for our centers isnt formatted correctly with the current format looking as such:
    <BRANDS>
         <BRAND>
              • BrandID = xxxx
              [Brand Name]
              [Description]
              [WebMoniker]
              <CATEGORIES>
                   <CATEGORY>
                        • xmlns = URL
                        • WebMoniker = category_type
              <STORES>
                   <STORE>
                        • StoreID = ID#
                        • CenterID = ID#
    I dont think this is currently usable because if I wanted to create a list of stores from a particular center, that information is stored as an attribute of the <Store> tag, buried deep within the data, making it impossible to 'drag-n-drop'. 
    Not to mention much of the important data is held in attributes rather than text fields which are children of the tag.
    Im thinking of proposing the following organizational layout:
    <CENTERS>
         <CENTER>
         [Center_name]
         [Center_location]
              <CATEGORIES>
                   <CATEGORY>
                        [Category_Type]
                        <BRANDS>
                             <BRAND>
                                  [Brand_name]
    My thought is that if I have the <CENTER> tag then I can simply drag that into a frame and it will auto populate all of the brands by Category (as organized in the XML) for that center into the frame.
    Why is this important?
    This is used on multiple documents in different layout styles, and since our store list is ever changes as leases end or begin, over 40 centers this becomes a big hairy monster.  We want this to be as automated as possible, but I'd settle for a significant amount of dragging and dropping as long as it is simple and straightforward.  I have a high tollerance for druding through code and creating work arounds but my co-workers do not.  This needs to be a system that is repeatable and understandable and needs to be able to function whether I'm here or not -- Mainly because I would like to step away from the responsibility of setting it up every time
    I'd love to hear your raw, unadulterated thoughts on the subject of Data merge and XML usage to accomplish these sorts of tasks.  What are your best practices and how would you / do you accomplish these operations?
    Regards-
    Robert

    From what I've gleaned through watching Lynda tutorials on the subject is that what I'm hoping to do is indeed possible.
    Peter, I dont disagree with you that there is a steep learning curve for me as the instigator / designer of this method for our team, but in terms of my teammates and end-users that will be softened considerably.  Even so I'm used to steep learning curves and the associated frustrations -- but I cope well with new learning and am self taught in many tools and programs.
    Flow based XML structures:
    It seems as though as long as the initial page is set up correctly using imported XML, individual data records that cascade in a logical fashion can be flowed automatically into new pages.  Basically what you do is to create an XML based layout with the dynamic portion you wish to flow in a single frame, apply paragraph styles to the different tags appropriately and then after deleting unused records, reimport the XML with some specific boxes checked (depending on how you wish to proceed).
    From there simply dragging the data root into the frame will cause overset text as it imports all the XML information into the frame.  Assuming that everything is cascaded correctly using auto-flow will cause new pages to be automatically generated with the tags correctly placed in a similar fashion to datamerge -- but far more powerful and flexible. 
    The issue then again comes down to data organization in the XML file.  In order to use this method the data must be organized in the same order in which it will be displayed.  For example if I had a Lastname field, and a Firstname field in that order, I could not call the Firstname first without faulting the document using the flow method.  I could, however, still drag and drop content from each tag into the frame and it would populate correctly regardless of the order of appearance in the XML.
    Honestly either method would be fantastic for our current set of projects, however the flow method may be particularly useful in jobs that would require more than 40 spreads or simple layouts with huge amounts of data to be merged.

  • Issues while iterating BDB XML

    Hello there,
    to begin with the issue, I've got a BDB XML, with couple of inserted documents. Using Java API.
    I'm creating an application which integrates the database within and displays the contents (that is, documents) of a container in a JTree.
    Next, I've overridden toString() of XmlDocument:
    class MyTreeModelChild extends XmlDocument{
        ContainerManager cmanager; //ContainerManager is the class, which deals with the environments settings, opening containers, putting documents etc.
        public MyTreeModelChild(XmlDocument v, ContainerManager cmanager) throws Exception{
            super(v);
            this.cmanager = cmanager;
        public String toString(){
            //executeQuery is the method, which executes XPath queries. It's located in ContainerManager class and takes a string argument
            try{
                XmlResults xResults = cmanager.executeQuery("collection('demo.dbxml')/info/title/string()");
                while(xResults.hasNext()){
                    XmlValue value = xResults.next();
                    return value.asString();
                return null;
            catch(Exception e){
                return e.toString();
    }The content of XML documents (don't mind the validation, that's an example):
    first.xml
    <info>
       <title>One</title>
    </info>
    second.xml
    <info>
       <title>Two</title>
    </info>Finally, I run the compiled code and watch the documents appear in the tree. They both have same titles (the second document is overridden by the first):
    -One
    -OneIf I check the query using dbxml shell, everything's nice:
    -One
    -TwoAny ideas, suggestions?
    Andy

    John,
    thank you for the reply.
    Indeed. The query returns the title of every document.
            try{
                XmlResults xResults = cmanager.executeQuery("collection('demo.dbxml')/info/title/string()");
                while(xResults.hasNext()){
                    XmlValue value = xResults.next();
                    return value.asString();
                }I execute the query and while it has some results to return, do the loop. Take the first value as a XmlValue and return it as String. If I have more results (in this case -- yes, I do), the loop runs again.
    Unfortunately, I cannot figure out what's from now on. The loop will return the same value.
    I'm nor a geek in BDB XML neither in Java. Almost there, just a few obstacles in the way :)

  • Some question for Sun Java System

    Dear all:
    I use Sun Java System We Server 7.0 for my project.
    But I have some question on SJSWS 7.0
    My server runtime information
    1. OS is RedHat Enterprise 3
    2. memory: 2G
    3. SJSWS version: 7.0 preview 3
    My questions
    Q1. The speed that download image is slower than the speed that run JSP page . The image's size to smaller than 5 KB. Is it possible to speed up download image
    Q2. My machine has 2GB memory, The system use swap area always. I think it isn't enough of SJSWS 7.0. How much memory size that SJSWS 7.0?
    Many thank for everybody

    first off, please try the Update 1 release in stead of technology preview releases: http://www.sun.com/download/products.xml?id=467713d6
    Q1> So I want to ask it is possible to display image and text at the same time like use Tomcat ?
    there is nothing in the server end (whether it's Tomcat or any other web server) that affects how the content is displayed on the browser.
    Q2>I detect The ram was used over 800M~1G by SJSWS7. My website has 80~150 user in workinghour
    Are you seeing Web Server process measuring so much memory?
    Q3> Is it possible that the admin server use SJSWS7U1 and some or all of node use SJSWS preview 3, because the server is running on line, I can't stop them for update server
    No - you want to switch to U1 anyway, since it's a released version (and is absolutely FREE for production use).

Maybe you are looking for