Working with XML in C
The Role of XML with C
The Extensive Markup Language has changed the way in which information is being viewed and exchanged. Users can share their sensitive documents on the World Wide Web by declaring what is theirs for EDI or Electronic Data Interchange, data publishing a data management tasks. XML is very structured and the data is highly organized, it marks the start and end of all tags and group by identifying similar elements in the XML document. This method which is followed by the XML makes the data reusable which is a very convenient factor for any programmer.
XML by itself is a structured program, and we need to depend on external programs to parse, generate, manipulate and validate the XML data. C or C++ is commonly used for writing XML documents. But these documents present their own challenges while composing a XML document.
The C code is known to be portable in nature but the compilation and linking procedures which it uses are not portable, and this is one major challenge which it presents while composing an XML document whose primary nature is its portability.
On different platforms C comes up with a requirement of being linked and compiled in a different way which should also suit the network environment. And the C code which is actually portable is not dynamic in nature.
So in any case C does present a challenge. To combat this problem C is again used along with Java or Java Virtual Machine, which are used to process the XML data.
Advantages of C with CH for XML
The C compatible CH language is a language embedded system which helps C overcome its shortcoming over networks, and the CH language support also provides C a capability to function over cross platforms and making it portable at the same time.
Some of its advantageous qualities when used with the CH language support combinations are that it offers an interpretive environment, where C programs can be easily implemented in CH language without having the need to debugged or executed.
C can also be used interactively by entering the code line y line and CH can be used to test the new functions simultaneously and it provides a good environment for real time computing. C along with CH can be easily embedded along with other various applications, programs, PDA’s, palmtops and network systems which makes it easy for the developer’s because they do not have the need to create separate scripts for different networking environments.
CH treats arrays as a first class object and it solves complex equations such as differential equations and integration problems. CH supports all kinds of classes, objects and enables the data to be encapsulated for object based programming. Using this data can be either hidden or abstracted.
CH contains features for low level languages and high level language so in that way it acts as a bridge between the low level languages and Very high level languages (VHLL).
Ch has inbuilt advanced level of languages which make sit easy for text handling. This feature is especially useful for system administration, and programming text based applications. CH also provides a shell for cross platform usage. This is very similar to c shell or the Bourne shell.
A CH program is extremely portable which makes it easy for C to gel with XML because a programmer can work and develop on one platform like the UNIX for example and after finishing with it, the program can be deployed on various platforms because of the usage of CH which other wise cannot be achieved by using only XML and C.
CH also offers extremely safe environment because it is designed right from the start and along with layers of security. It offers a broad choice of libraries to the program which is used at various levels of the program which is being built.
Using C API for XML
XML uses the C API parser for XML developer’s kit and XML Database in oracle. It can be considered as a C based Data object model for XML. Whether the data is out side or inside the databases, irrespective of the situation it can be used in XML.
There are some performance improving extensions and parameters which is an integral part of this API which can be used in XML like the ML developers kit which can be used for storage of XML in a traditional pattern and the Oracle ML database which can store the XML as XML type in the table in one of the columns.
In the Oracle XML database the C API is started in XML only. The World Wide Web Consortium highly recommends the DOM, which has a very broad meaning for the word document itself. The programming interface in the C API environment is a combined effort and it also includes all the required functions which are needed by XML developer’s kit and Oracle XML Data Base using applications.
XSLT is provided for these databases and the XML Schema is also implemented. Even though the World Wide Web consortiums highly recommended DOM 2.0 was closely adhered to and followed, still further naming changes were required and had to be implemented in the DOM 2.0 like the recommendation for C namespace for example and another example is that the method called getName() had to be renamed to getAttrName().
The C API for XML is super fast and overtakes all the existing API’s. Especially, the oraxml and the oraxsd.h interface which is top-level in Data Object Model and SAX, and also the XSLT along with the XML schema interfaces which has high chances of facing criticism in the future of the XML and C scenario.
Support for storage is provided by the XML data base and it also allows the XML instances to be manipulated by using the data type which is XML type. The XML instances that can be accessed and even manipulated by using tools like Oracle Call interface or OCI in a unanimous combination with the C data object model API for extensive markup language.
Every application program for its flow of information would involve all the data object model functions for C. The Oracle XML data base which stores the XML data can be accessed by the client side by using the structure in C data object model called the xmldocnode. The xmldocnode structure is mainly used in the database for functions like binding and defining, operating the Oracle call interface values in XML.
C DOM API functions require all the parameters in the XML context. The information that is encapsulated in a very opaque manner while the process of data encoding is taking place, and processes like the error message coding is going on.
Oracle XML Developers Kit applications and Oracle XML Data Base are quite different from each other because the content in their context itself is very different. For Oracle XML Data Base itself there are two Oracle Call Interface functions which will initiate the function called OCIXmlDbInitXmlCtx() and will terminate the function called OCIXmlDbFreeXmlCtx() in an XML context.
Integrating Oracle and C
In the C environment the dynamic C and C++ libraries which are binary or static or dynamic can be integrated with the language in use and its environment without having the need to recompile the while thing all over again. Any C or C++ application can be deployed effectively even in cross platforms using the CH XML package which is an integral part of the Oracle XML Library. They can be deployed on the internet also.
Integration with DOM API
The data object model of API in XML will create a tree structure which will store the XML documents within the memory itself. There are no call back functions that are available for the data object model based CML c or C++ applications. In any case it is very simple to create a CH binding for the Oracle data object model API for the XML developer kit.
The oracle XML developers Kit gels well with the CH. There are three layers in the architecture mainly, the user applications is on the first layer, which consists of the applications that are using the libraries in C and C++. The second layer consists of the CH wrapper which acts as the middleware for the functions which interpret using text based coding and the binary functions. The CH wrapper also known as the CH binder has been mainly developed for usage in the XML developer’s kit. The source code is freely available for the CH binder on the internet.
For the CH binding to be deployed on different platforms the open source can be used and also with the different versions of the XML developers kit. In some cases as the main functions version gets upgraded the accessories get left behind and sometimes turns incompatible with the main function itself. SO again a different process is invoked to upgrade the accessory also. The last layer consists of the authentic and original C and C ++ binary data which is provided by the XML developers kit.