Sunday, May 26, 2013

Essential Eclipse Shortcuts keys


File Navigation – Eclipse Shortcuts


  • CTRL SHIFT R – Open a resource. You need not know the path and just part of the file name is enough.
  • CTRL E – Open a file (editor) from within the list of all open files.
  • CTRL PAGE UP or PAGE DOWN – Navigate to previous or next file from within the list of all open files.
  • ALT <- or ALT -> – Go to previous or next edit positions from editor history list.


Java Editing – Eclipse Shortcuts


  • CTRL SPACE – Type assist
  • CTRL SHIFT F – Format code.
  • CTRL O – List all methods of the class and again CTRL O lists including inherited methods.
  • CTRL SHIFT O – Organize imports.
  • CTRL SHIFT U – Find reference in file.
  • CTRL / – Comment a line.
  • F3 – Go to the declaration of the variable.
  • F4 – Show type hierarchy of on a class.
  • CTRL T – Show inheritance tree of current token.
  • SHIFT F2 – Show Javadoc for current element.
  • ALT SHIFT Z – Enclose block in try-catch.


General Editing – Eclipse Shortcuts


  • F12 – Focus on current editor.
  • CTRL L – Go to line number.
  • CTRL D – Delete a line.
  • CTRL <- or -> – Move one element left or right.
  • CTRL M – Maximize editor.
  • CTRL SHIFT P – Go to the matching parenthesis.


Debug, Run – Eclipse Shortcuts


  • CTRL . or , – Navigate to next or previous error.
  • F5 – Step into.
  • F6 – Step over.
  • F8 – Resume
  • CTRL Q – Inspect.
  • CTRL F11 – Run last run program.
  • CTRL 1 – Quick fix code.


Search – Eclipse Shortcuts


  • CTRL SHIFT G – Search for current cursor positioned word reference in workspace
  • CTRL H – Java search in workspace.












---------------------------------------------------------------------------

Eclipse Shortcuts
Essential Eclipse Shortcuts
Effective Eclipse: Shortcut keys 
 useful Keyboard Shortcuts for Eclipse
10 Eclipse Navigation Shortcuts Every Java Programmer Should Know
Top 30 Eclipse Keyboard Shortcuts for Java Programmer
Eclipse Shortcuts 
eyboard Shortcuts Eclipse 
Eclipse getter/setter shortcut key
Eclipse Shortcuts - Java Tutorial Blog
Searches related to eclipse shortcuts
eclipse shortcuts cheat sheet
eclipse shortcuts pdf
eclipse shortcuts cheat sheet pdf
eclipse keyboard shortcuts
eclipse change shortcuts
eclipse shortcuts comment
eclipse shortcuts delete line
eclipse shortcuts for java
10 Best Eclipse Shortcuts 
20 very useful Eclipse IDE Shortcuts. Eclipse Shortcut. Java IDE
Favorite shortcuts in eclipse
List of shortcuts key for Eclipse Java Programming
Eclipse - Shortcuts 

Tuesday, May 21, 2013

How to use Xerces Library to parse the XML file with Visual C++ Project



The Apache project's Xerces-C libraries support the DOM approach to XML parsing. The entire XML file is imported into memory and the data is held as nodes in a data tree which can be traversed for information.
The Xerces-C C++ parser home page: http://xml.apache.org/xerces-c/


So download the latest version of  Xerces Library and place it into your project  folder.
The Xerces Library folder contains the following files and folders inside it Shown in the picture .



Now make a new project or open your current project and Right click your project and go to “project properties”. Now go to “VC++ directories” and then go to “Include directories” and give the path of the Xerces Library include folder as shown in the picture below.



Now go to “VC++ directories” and then go to “Library directories” and give the path of the Xerces Library lib folder as shown in the picture below.



Now go to “Linker” -> “Input” and then go to “Additional directories” and give the path of the Xerces Library file as shown in the picture below.

Now write the following code to parse the directories.



#include <iostream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOMText.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/HandlerBase.hpp>

using namespace std;
using namespace xercesc;

void write(DOMNode* node);
void writeElement(DOMElement* element);
void writeText(DOMText* text);

void
write(DOMNode* node) {
     if (node) {
           switch (node->getNodeType()) {
           case DOMNode::ELEMENT_NODE:
                writeElement(static_cast<DOMElement*>(node));
                break;
           case DOMNode::TEXT_NODE:
                writeText(static_cast<DOMText*>(node));
                break;
           }

           DOMNode* child = node->getFirstChild();
           while (child) {
                DOMNode* next = child->getNextSibling();
                write(child);
                child = next;
           }
     }
}

void
writeElement(DOMElement* element) {
     char* name = XMLString::transcode(element->getTagName());
     cout << "tag    : " << name << endl;
     XMLString::release(&name);

     DOMNamedNodeMap* map = element->getAttributes();
     for (XMLSize_t i = 0; i < map->getLength(); i++) {
           DOMAttr* attr = static_cast<DOMAttr*>(map->item(i));
           char* attr_name  = XMLString::transcode(attr->getName());
           char* attr_value = XMLString::transcode(attr->getValue());
           cout << attr_name << ": "<< attr_value << endl;

           XMLString::release(&attr_name);
           XMLString::release(&attr_value);
     }
}

void
writeText(DOMText* text) {
     XMLCh* buffer = new XMLCh[XMLString::stringLen(text->getData()) + 1];
     XMLString::copyString(buffer, text->getData());
     XMLString::trim(buffer);
     char* content=XMLString::transcode(buffer);
     delete[] buffer;

     cout << "content: " << content << endl;
     XMLString::release(&content);
}

int main(int argc, char* args[]) {

     try {
           XMLPlatformUtils::Initialize();
     } catch (const XMLException& toCatch) {
           char* message = XMLString::transcode(toCatch.getMessage());
           cout << "Error during initialization! :\n" << message << "\n";
           XMLString::release(&message);
           return 1;
     }

     XercesDOMParser* parser = new XercesDOMParser();
     parser->setValidationScheme(XercesDOMParser::Val_Always);
     parser->setDoNamespaces(true); // optional

     ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
     parser->setErrorHandler(errHandler);

     const char* xmlFile = "samples/data/personal.xml";

     try {
           parser->parse(xmlFile);
           DOMDocument* dom = parser->getDocument();
           write(dom);
     } catch (const XMLException& toCatch) {
           char* message = XMLString::transcode(toCatch.getMessage());
           cout << "Exception message is: \n" << message << "\n";
           XMLString::release(&message);
           return -1;
     } catch (const DOMException& toCatch) {
           char* message = XMLString::transcode(toCatch.msg);
           cout << "Exception message is: \n" << message << "\n";
           XMLString::release(&message);
           return -1;
     } catch (...) {
           cout << "Unexpected Exception \n";
           return -1;
     }

     delete parser;
     delete errHandler;
     return 0;
}






Compile:
RPM installed: g++ -g -Wall -pedantic -lxerces-c parser.cpp -DMAIN_TEST -o parser 

or
Installed to "/opt": g++ -g -Wall -pedantic -I/opt/include -L/opt/lib -lxerces-c parser.cpp -DMAIN_TEST -o parser



Now Run  the program..


































































-----------------------------------------------------


Searches related to xerces c++ example
xerces xpath example c++
xerces c++ tutorial
xerces c++ sax parser example
xerces samples
libxerces
Xerces for C++ Using Visual C++
Searches related to xerces visual c++ example
visual studio example
visual basic example
C++ XML with Xerces
Configuring Xerces-C++ XML Libraries with Visual Studio 2008
c++ parse xml
c++ read xml
Xerces for C++ Tutorial Using Visual C++
xml reader c++
Linux Tutorial: Parsing XML with Xerces-C C++ API
Xerces-C++ Samples
Xerces for C++ Tutorial Using Visual C++ 
Xerces for C++