XML - Practical Example?

Hello,
I've read some articles on XML, and it seems to be popular, but I really am not sure why. I fail to see it's practical use.
For example, can I use XML to create a config file for my java application? Is this a practical use? Why not just use a text file?
Can someone describe some simple and practical examples of XML use? If it is something that will improve my knowledge and skill set, I'd like to learn it, but I don't yet see it's value, despite reading a lot about.
For example... I need a config file for an application that contains info like this:
[CATEGORIES]
GUNS
SHIELDS
CAPACITORS
[GUNS]
Lasers
Particle
Projectile
Etc...
Is an XML file a good idea for creating this type of config file?
Thanks

You need to pass data including integers and floating point numbers between AS400, Solaris and windows. The producer is any of the three and the consumer is any of the three. Each application on each OS uses some but not all of the data. Version 2 will be adding more fields and the developement teams for each application live in different countries. Finally the project times lines for each application do not line up (some applications will be placed into production before the others are out of the coding phase.)
Or alternatively just to keep the programmers happy. Which is always a good thing.

Similar Messages

  • I want to check the main diffrence in Pop up block enabled and disabled.But,i don't get any difference.Would u please help me to understand the difference using one practical example of website

    I want to check the main diffrence in Pop up block enabled and disabled.But,i don't get any difference.Would u please help me to understand the difference using one practical example of website

    Here's two popup test sites.
    http://www.kephyr.com/popupkillertest/test/index.html
    http://www.popuptest.com/

  • Doubts in XI basics..help me with some practical examples

    hi friends,
              I am new to SAP XI have some basic doubts. Answer my questions with some practical examples.
      1. what is meant by "Business System" and what is difference between client,customer,Business partner,3rd party
      2.If a small company already using some systems like Oracle or peopleSoft,if it wants to use SAP products then what steps it has to follow.
    3. SAP system means a SERVER?
    4.SAPWebAs means a server software?
    5.R/3 system comes under SAP system?
    6.XI is also one of the SAP  module..how it relates to other modules.
    7.In one organization which is using SAP modules,each module will be load in separate servers?
    8.PO(purchase order) means just looks like one HTML file..customer will fill the form and give it.like this,Combination of many files like this is one SAP module.Is it right assumption..?if so,then what is speciality SAP?
       I have an theoretical knowledge about IR and ID and SLD.what are general business transactions happens in any business ?(like who will send cotation,PO)  give some practical example for what actually happens in business?..who will do what?and what XI will do?

    Hi Murali,
    <u><b> 1.Business System</b></u>
      Business systems are logical systems that function as senders or receivers  within the SAP Exchange Infrastructure(XI).
    Before starting with any XI interface,the Business systems involved has to be configured in SLD(The SLD acts as the central information provider for all installed system components in your system landscape.)
    business system and technical system in XI
    <u><b>2.Third Party</b></u>
    http://help.sap.com/saphelp_nw04/helpdata/en/09/6beb170d324216aaf1fe2feb8ed374/frameset.htm
    eg.For the SAP system a  Bank would be a third-party which would be involved in interfaces involving exchange of data(Bill Payment by customer).
    <u><b>3.XI(Exchange Infrastructure)</b></u>
      It enables you to connect systems from different vendors (non-SAP and SAP) in different versions and implemented in different programming languages (Java, ABAP, and so on) to each other.
    Eg.If an interface involves Purchase Order sent from SAP system to the vendor(Non-SAP system)then,the vendor might expect a file.But the Data is in the IDOC(intermediate document) form with the SAP system.Here XI does the work of mapping the IDOC fields and the File fields and sends it to the vendor in the form of a file.
    In short,always the scene is Sender-XI-Receiver.
    The Sender and the Receiver depends upon the Business you are dealing with.
    <u><b>4.Business Partner</b></u>
    A person, organization, group of persons, or group of organizations in which a company has a business interest.
    This can also be a person, organization or group within this company.
    Examples:
    Mrs. Lisa Miller
    Maier Electricals Inc.
    Purchasing department of Maier Electricals Inc.
    <u><b>5.Client</b></u>
    http://help.sap.com/saphelp_nw04/helpdata/en/6c/a74a3735a37273e10000009b38f839/frameset.htm
    <u><b>6.SAP System</b></u>
    http://help.sap.com/saphelp_nw04/helpdata/en/33/1f4f40c3fc0272e10000000a155106/frameset.htm
    <u><b>7.SAP WebAS</b></u>
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=sapwebapplication+server&cat=sdn_all
    As you are a beginner, I understand you musn’t be aware of where to search what.
    For all details search out in http://help.sap.com
    And sdn(key in keyword in Search tab).
    You will get list of forums,blogs,documentation answering all your queries.

  • Practical example of the SessionSynchronization interface

    Hello,
    Can anyone give me a practical example of use of the SessionSynchronization interface please?
    Thanks in advance,
    Julien Martin.

    just hoping will answer my question. Reactivaing my thread;
    Julien.

  • Simple XML DOM Example Needed.

    I need a simple XML DOM Example that reads in the XML and makes objects out of the elements. The tutorial from sun is very sketchy and seems to good far too quickly.
    Thanks,
    Dave.

    You can find some examples:
    http://java.sun.com/xml/jaxp/dist/1.0.1/examples/#building
    http://newinstance.com/writing/javaxml2/javaxml2_examples.html
    http://www.docuverse.com/domsdk/index.html#tutorial
    http://www.devx.com/sourcebank/search.asp

  • Servlets & XML-RPC Example

    Since I am not having any luck on the Java & XML forum (http://forum.java.sun.com/thread.jsp?forum=34&thread=512728&tstart=0&trange=15)
    I thought I would try here. Does anyone know of a good example on the web they can point me to that shows XML-RPC with servlets as I cannot find any and the examples dir from the Apache distribution of XML-RPC (which is supposed to have such an example) is MIA. Thanks.

    hello,
    I am looking for the same servlet xml-rpc example, Have you found it ?
    nojkan

  • Practical examples of ejbSelect methods

    Hello,
    I understand ejbFindXX methods are used by ejb clients whereas ejbSelectXX methods are used by the ejb itself. Is that the difference? Can anyone give me a practical example/use of an ejbSelectXX method?
    Thanks in advance,
    Albert Steed

    Refer to
    http://www.onjava.com/pub/a/onjava/2001/09/19/ejbql.html

  • Can anyone provide a practical example of when Etherchannel would be configured but then NOT trunked...

    I am in the process of educating a client of mine about all aspects of switching.
    I was teaching them about Etherchannel the other day, when I realized that I did not know for sure whether or not one could create an Etherchannel and then not trunk it.
    Based on some examples I have seen, I am still led to believe it is possible.
    I am just trying to think of a practical example of configuring such...  The only thing that comes to my mind is if you are NIC teaming a server's two NIC's then we may want to Etherchannel but not trunk?...
    Thanks in Advance!

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    Another example would be a p2p link between two L3 switches.

  • Practical examples for SAP BI

    Hi BI-experts!
    Can some one please recommend some practical examples/case studies to gain practical experience with SAP BI?
    - Data modelling/procurement and Reporting
    - Integrated Planing
    - BW based Consolidation
    Also other web sources, SAP books will be very appreciated.
    I already went through the first example "From the Data Model to the BI Application in
    the Web" and SAP courses SAP BW305 and 310.
    Any helpful information will be very appreciated.
    Thank you very much!
    regards
    Thom

    Hi,
    I suggest first you go through the what is BI? then where it is used, which scenario BI is usually required, for that go through this links,
    BI platform:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/594e3c6bf4233fe10000000a114084/frameset.htm
    DTPs:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/fb8ed8481e1a61e10000000a422035/frameset.htm
    Extractions in BI
    https://www.sdn.sap.com/irj/sdn/wiki
    transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    Difference BI and BW
    /people/sap.user72/blog/2004/11/01/sap-bi-versus-sap-bw-what146s-in-a-name
    SAP (NetWeaver) BI versus SAP BW: The Sequel
    What's new in SAP NetWeaver 7.0(2004s)? - An introduction to the functionality deltas and major changes
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/910aa7a7-0b01-0010-97a5-f28be23697d3
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4487dd91-0b01-0010-eba1-bcd6419
    http://help.sap.com/saphelp_nw04/helpdata/en/b2/e50138fede083de10000009b38f8cf/content.htm
    Hope it will help you.
    Thanks & Regards,
    SD

  • Hello World XML/XSL example not working in IE

    I am trying to get the "Hello World" XML/XSL example to work in IE.
    Could anyone help me out?
    The code follows:
    hello.xml
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="hello.xsl"?>
    <hello-world>
    <greeter>An XSLT Programmer</greeter>
    <greeting>Hello, World!</greeting>
    </hello-world>
    hello.xsl
    <?xml version="1.0"?>
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="/hello-world">
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    <H1><xsl:value-of select="greeting"/></H1>
    <xsl:apply-templates select="greeter"/>
    </BODY>
    </HTML>
    </xsl:template>
    <xsl:template match="greeter">
    <DIV>from
    <I><xsl:value-of select="."/></I>
    </DIV>
    </xsl:template>
    </xsl:stylesheet>
    Both files are in the same directory.
    When hello.xml is opened in IE, the output displayed is just, "from".
    What's wrong, and where?
    Please help!
    - Edwin.

    Hi edwinwaz,
    In response to your question, pls refer to this url
    http://www.w3schools.com/xsl/el_template.asp
    and take a look at the "note" in red.
    It says that IE5.X have non-standard behavior on the element <xsl:template>
    In addition, I have tested your code it works fine.
    Just to add something on your code here.
    I noticed that you do this
    <xsl:apply-templates select="greeter"/>
    and then in another template you do this
    <xsl:template match="greeter">
    <!-- code -->
    </xsl:template>
    In this case, it does work because "greeter" is a top-level element but if "greeter" is anything underneath the top-level element. It won't work.
    Actually, I discovered this after taking a look at your example and
    I was surprised that the code above worked and then I did some testing and discovered this.
    I am learning XML too now... So, I am happy to know this :).
    regards

  • Where can I find XML component examples ?

    where can I find XML components examples ?

    Here are a couple video tutorials using XML with Flash:
    http://www.gotoandlearn.com/play?id=64
    http://www.gotoandlearn.com/play?id=65
    Don't know if they're what you're looking for but worth a
    look.

  • Initialization Blocks -- Practical Example.

    I am curious about I topic that I have just recently learned about and would like to post it for discussion.
    Does anyone know of a practical example of the use of an initialization block? Why would one want to use an initialization block? What can be accomplished with an initialization block that you cannot accomplish with a constructor that doesn't accept any parameters?

    Hi Robert,
    Initializers are used in initialization of object and classes. They can also be used to define constants in Interfaces.
    Here I am explaning by corelating the Constructor with Initialization.
    In what order is initialization code executed? What should I put where ?
    Instance variable initialization code can go in three places within a class:
    In an instance variable initializer for a class (or a superclass).
    class C {
    String var = "val";
    In a constructor for a class (or a superclass).
    public C() { var = "val"; }
    In an object initializer block. This is new in Java 1.1; its just like a static initializer block but without the keyword static.
    { var = "val"; }
    The order of evaluation (ignoring out of memory problems) when you say new C() is:
    1.Call a constructor for C's superclass (unless C is Object, in which case it has no superclass). It will always be the no-argument constructor, unless the programmer explicitly coded super(...) as
    the very first statement of the constructor.
    2.Once the super constructor has returned, execute any instance variable initializers and object initializer blocks in textual (left-to-right) order. Don't be confused by the fact that javadoc and
    javap use alphabetical ordering; that's not important here.
    3.Now execute the remainder of the body for the constructor. This can set instance variables or do anything else.
    In general, you have a lot of freedom to choose any of these three forms. My recommendation is to use instance variable initailizers in cases where there is a variable that takes the same value
    regardless of which constructor is used. Use object initializer blocks only when initialization is complex (e.g. it requires a loop) and you don't want to repeat it in multiple constructors. Use a constructor
    for the rest.
    Here's another example:
    Program:
    class A {
    String a1 = ABC.echo(" 1: a1");
    String a2 = ABC.echo(" 2: a2");
    public A() {ABC.echo(" 3: A()");}
    class B extends A {
    String b1 = ABC.echo(" 4: b1");
    String b2;
    public B() {
    ABC.echo(" 5: B()");
    b1 = ABC.echo(" 6: b1 reset");
    a2 = ABC.echo(" 7: a2 reset");
    class C extends B {
    String c1;
    { c1 = ABC.echo(" 8: c1"); }
    String c2;
    String c3 = ABC.echo(" 9: c3");
    public C() {
    ABC.echo("10: C()");
    c2 = ABC.echo("11: c2");
    b2 = ABC.echo("12: b2");
    public class ABC {
    static String echo(String arg) {
    System.out.println(arg);
    return arg;
    public static void main(String[] args) {
    new C();
    Output:
    1: a1
    2: a2
    3: A()
    4: b1
    5: B()
    6: b1 reset
    7: a2 reset
    8: c1
    9: c3
    10: C()
    11: c2
    12: b2
    When should I use constructors, and when should I use other methods?
    The glib answer is to use constructors when you want a new object; that's what the keyword new is for. The infrequent answer is that constructors are often over-used, both in when they are called and
    in how much they have to do. Here are some points to consider
    Modifiers: As we saw in the previous question, one can go overboard in providing too many constructors. It is usually better to minimize the number of constructors, and then provide modifier
    methods, that do the rest of the initialization. If the modifiers return this, then you can create a useful object in one expression; if not, you will need to use a series of statements. Modifiers are
    good because often the changes you want to make during construction are also changes you will want to make later, so why duplicate code between constructors and methods.
    Factories: Often you want to create something that is an instance of some class or interface, but you either don't care exactly which subclass to create, or you want to defer that decision to
    runtime. For example, if you are writing a calculator applet, you might wish that you could call new Number(string), and have this return a Double if string is in floating point format, or a Long if
    string is in integer format. But you can't do that for two reasons: Number is an abstract class, so you can't invoke its constructor directly, and any call to a constructor must return a new instance
    of that class directly, not of a subclass. A method which returns objects like a constructor but that has more freedom in how the object is made (and what type it is) is called a factory. Java has no
    built-in support or conventions for factories, but you will want to invent conventions for using them in your code.
    Caching and Recycling: A constructor must create a new object. But creating a new object is a fairly expensive operation. Just as in the real world, you can avoid costly garbage collection by
    recycling. For example, new Boolean(x) creates a new Boolean, but you should almost always use instead (x ? Boolean.TRUE : Boolean.FALSE), which recycles an existing value rather than
    wastefully creating a new one. Java would have been better off if it advertised a method that did just this, rather than advertising the constructor. Boolean is just one example; you should also
    consider recycling of other immutable classes, including Character, Integer, and perhaps many of your own classes. Below is an example of a recycling factory for Numbers. If I had my choice, I
    would call this Number.make, but of course I can't add methods to the Number class, so it will have to go somewhere else.
    public Number numberFactory(String str) throws NumberFormatException {
    try {
    long l = Long.parseLong(str);
    if (l >= 0 && l < cachedLongs.length) {
    int i = (int)l;
    if (cachedLongs[i] != null) return cachedLongs;
    else return cachedLongs[i] = new Long(str);
    } else {
    return new Long(l);
    } catch (NumberFormatException e) {
    double d = Double.parseDouble(str);
    return d == 0.0 ? ZERO : d == 1.0 ? ONE : new Double(d);
    private Long[] cachedLongs = new Long[100];
    private Double ZERO = new Double(0.0);
    private Double ONE = new Double(1.0);
    We see that new is a useful convention, but that factories and recycling are also useful. Java chose to support only new because it is the simplest possibility, and the Java philosophy is to keep the
    language itself as simple as possible. But that doesn't mean your class libraries need to stick to the lowest denominator. (And it shouldn't have meant that the built-in libraries stuck to it, but alas, they
    did.)
    I have a class with six instance variables, each of which could be initialized or not. Should I write 64 constructors?
    Of course you don't need (26) constructors. Let's say you have a class C defined as follows:
    public class C { int a,b,c,d,e,f; }
    Here are some things you can do for constructors:
    1.Guess at what combinations of variables will likely be wanted, and provide constructors for those combinations. Pro: That's how it's usually done. Con: Difficult to guess correctly; lots of
    redundant code to write.
    2.Define setters that can be cascaded because they return this. That is, define a setter for each instance variable, then use them after a call to the default constructor:
    public C setA(int val) { a = val; return this; }
    new C().setA(1).setC(3).setE(5);
    Pro: This is a reasonably simple and efficient approach. A similar idea is discussed by Bjarne Stroustrop on page 156 of The Design and Evolution of C++. Con: You need to write all the little
    setters, they aren't JavaBean-compliant (since they return this, not void), they don't work if there are interactions between two values.
    3.Use the default constructor for an anonymous sub-class with a non-static initializer:
    new C() {{ a = 1; c = 3; e = 5; }}
    Pro: Very concise; no mess with setters. Con: The instance variables can't be private, you have the overhead of a sub-class, your object won't actually have C as its class (although it will still be an
    instanceof C), it only works if you have accessible instance variables, and many people, including experienced Java programmers, won't understand it. Actually, its quite simple: You are defining a
    new, unnamed (anonymous) subclass of C, with no new methods or variables, but with an initialization block that initializes a, c, and e. Along with defining this class, you are also making an
    instance. When I showed this to Guy Steele, he said "heh, heh! That's pretty cute, all right, but I'm not sure I would advocate widespread use..."
    4.You can switch to a language that directly supports this idiom.. For example, C++ has optional arguments. So you can do this:
    class C {
    public: C(int a=1, int b=2, int c=3, int d=4, int e=5);
    new C(10);
    Common Lisp has keyword arguments as well as optional arguments, so you can do this:
    (defstruct C a b c d e f) ; Defines the class
    (make-C :a 1 :c 3 :e 5) ; Construct an
    instance
    What about class initialization?
    It is important to distinguish class initialization from instance creation. An instance is created when you call a constructor with new. A class C is initialized the first time it is actively used. At that time,
    the initialization code for the class is run, in textual order. There are two kinds of class initialization code: static initializer blocks (static { ... }), and class variable initializers (static String var =
    Active use is defined as the first time you do any one of the following:
    1.Create an instance of C by calling a constructor;
    2.Call a static method that is defined in C (not inherited);
    3.Assign or access a static variable that is declared (not inherited) in C. It does not count if the static variable is initialized with a constant expression (one involving only primitive operators (like +
    or ||), literals, and static final variables), because these are initialized at compile time.
    Here is an example:
    Program:
    class A {
    static String a1 = ABC.echo(" 1: a1");
    static String a2 = ABC.echo(" 2: a2");
    class B extends A {
    static String b1 = ABC.echo(" 3: b1");
    static String b2;
    static {
    ABC.echo(" 4: B()");
    b1 = ABC.echo(" 5: b1 reset");
    a2 = ABC.echo(" 6: a2 reset");
    class C extends B {
    static String c1;
    static { c1 = ABC.echo(" 7: c1"); }
    static String c2;
    static String c3 = ABC.echo(" 8: c3");
    static {
    ABC.echo(" 9: C()");
    c2 = ABC.echo("10: c2");
    b2 = ABC.echo("11: b2");
    public class ABC {
    static String echo(String arg) {
    System.out.println(arg);
    return arg;
    public static void main(String[] args) {
    new C();
    Output:
    1: a1
    2: a2
    3: b1
    4: B()
    5: b1 reset
    6: a2 reset
    7: c1
    8: c3
    9: C()
    10: c2
    11: b2
    I hope the above will help you.
    Thanks
    Bakrudeen

  • CMIR - Practical example

    Can anyone give a practical example (with real names) of a customer material info record creation.
    I want an example of a material .... what does the customers call it ... and what does the company call it internally..
    Thanks and would appreciate if i only get the practical names.....i am not looking at theoritical working of CMIR.
    Thanks again

    Dear Arijeet
    CMIR is mainly used (according to me) in Automotive Industries where the OEMs (Original Equipment Manufacturers) like Hyundai, Maruthi etc., have their own part reference and they will insist their Vendors to show this part in all official documents.  In fact, almost all OEMs will process payment only if the manufacturers billing document shows their part reference.
    Practically, manufacturer will have their own part code for various reasons like differentiating the components at each stage like whether it is an inhouse process component or boughtout component etc.,  So over a period of time, just by going through the material code itself, they will be able to tell whether the nature of component (inhouse or boughtout).
    Here they cannot just like that adhere to customer's requirement but at the sametime, in order to satisfy customer requirement, they will maintain both manufacturers part number and customer part number in CMIR and while printing, they have to define a logic in such a way that only Customer material code should fetch from VD52.
    Similarly, in terms of description also this is applicable.
    For a few products manufactured in India by a manufacturer, they call it as autoparts whereas the overseas customer calls it as Internal Combustion Engine parts.
    Hoping that I have understood your question correctly and explained the above.  If this is not what you had asked for, then please brief once again.
    thanks
    G. Lakshmipathi

  • SDN is a best-practice example in a Novell success story

    Regular SDNers might be interested to see SDN used as a "success story" by Novell for their eDirectory product.  Novell produced both a pdf and has the success story easily accessible on the Novell website at http://www.novell.com/success/sap.html  It's nice to see SDN used as an example of a "best practice" ... as regular SDN members know it is, in so many ways.

    Look into using NWDI as your source code control (DTR) and transport/migration from dev through to production.  This also will handle the deployment to your dev system (check-in/activate).
    For unit testing and debugging you should be running a local version (NWDW).  This way once the code is ready to be shared with the team, you check it in (makes it visible to other team members) and activate it (deploys it to development server).
    We are currently using a separate server for WD applications rather than running them on the portal server.  However, this does not allow for the WD app to run in the new WD iView.  So it depends on what the WD app needs to do an have access to.  Of course there is always the Federated Portal Network as an option, but that is a whole other topic.
    For JCo connections, WD uses a connection name and this connection can be set up to point to different locations depending on which server it is on.  So on the development server the JCo connection can point to the dev back-end and in prod point to the prod back-end.  The JCo connections are not migrated, but setup in each system.
    I hope this helps.  There is a lot of documentation available for NWDI to get you started.  See:  http://help.sap.com/saphelp_erp2005/helpdata/en/01/9c4940d1ba6913e10000000a1550b0/frameset.htm
    -Cindy

  • C/C++ OCI XML support examples

    Hi all,
    I'm trying to find some simple C/C++ examples of accessing XMLType columns from OCI. I'm interested in examples that show the basics like querying an XMLType column and inserting values into an XMLType column. I'm mainly interested in examples that deal with the XMLType column when the data is stored in the database as a CLOB though I'm not sure if the client side really cares about that.
    My application is based on the 9i OCI client since we still need to support that so I think that some of the newer OCI XML calls will not be available. I'm already quite familiar with programming in OCI, and I'm in the process of adding support for XML to our applicaiton so I just need some sample code that shows the basics and then hopefully I can figure things out from there.
    Any help would be much appreciated.
    Thanks,
    Nick

    It's possible to get XMLTYPE column in OCI without converting them to string or clob. I was able to do it by taking just the XDK headers and using only those functions declared there which are exposed by oci.dll directly. Here's the comment from my code:
    <tt>
    // Only calls which are defined in xmlproc.h (in xdb/include) as
    // #define XmlXYZ which take an xctx as first param, and cast back
    // xctx into xmlctxhead, then access the struct of function pointers,
    // are accessible to a pure OCI / Instance Client app.
    </tt>
    Crystal clear, no? ;-)
    The code below could be compiled with Instant Client augmented with xdk/include/*.h. It depends on a few classes and methods not listed (it's part of a bigger file), but if you program with OCI you should be able to replace them with something that works. It's quite rough, my own experimentation, before moving on to wrap all this messy C-code into nicer looking C++, but it shows that it can be done. Notice you need to init on Object mode, and given that it uses undocumented functions for the parsing, probably not supported at all by Oracle.
    Anyways, I hope its useful to someone. --DD
    PS: Sorry, looks like the forum garbles the code a little in HTML. don't know how to fix that. Maybe look at the source for the HTML.
    <tt>
    #include <xmlotn.h>
    * \brief Replacement for official XmlSaveDom not accessible to Instant-Clients
    * This method wraps calls to the unofficial XmlSaveDomVA method exposed by
    * Oracle contexts, to work around the fact that XmlSaveDom is not accessible
    * to applications deployed against Oracle's Instant Client runtime.
    * The real XmlSaveDom may be taking advantage of more undocumented key/value
    * pairs supported by underlying XmlSaveDomVA methods, to do proper error
    * handling possibly, which may explain why XmlSaveDomVA does not return the
    * number of bytes written, as advertised by XmlSaveDom's documentation.
    static xmldocnode* myXmlLoadDom(xmlctx* xctx, xmlerr* err, ...) {
    va_list v;
    va_start(v, err);
    xmldocnode*const rc = XmlLoadDomVA(xctx, err, v);
    va_end(v);
    return rc;
    static xmldocnode* load_dom_from_string(
    xmlctx* xctx, const char* doc_string, ub4 string_len
    SystemTimer timer;
    xmlerr err = XMLERR_OK;
    xmldocnode*const doc = myXmlLoadDom(
    xctx, &err,
    "buffer", doc_string,
    "buffer_length", string_len,
    NULL // sentinel marking end of key/value pairs
    if (err != XMLERR_OK || doc == NULL) {
    cerr << "Error parsing XML string" << endl;
    // throw?
    cout << "loaded dom in " << timer << endl;
    return doc;
    static xmldocnode* load_dom_from_file(
    xmlctx* xctx, const char* filename
    SystemTimer timer;
    xmlerr err = XMLERR_OK;
    xmldocnode*const doc = myXmlLoadDom(
    xctx, &err,
    "file", filename,
    NULL // sentinel marking end of key/value pairs
    if (err != XMLERR_OK || doc == NULL) {
    cerr << "Error parsing XML file " << filename << endl;
    // throw?
    cout << "loaded dom in " << timer << endl;
    return doc;
    static ubig_ora myXmlSaveDom(xmlctx* xctx, xmlerr* err, xmlnode* root, ...) {
    SystemTimer timer;
    va_list v;
    va_start(v, root);
    const ubig_ora rc = XmlSaveDomVA(xctx, err, root, v);
    va_end(v);
    cout << "saved dom in " << timer << endl;
    return rc;
    // TODO: On truncation, retry with increasingly larger heap buffer
    // and re-attempt serialization.
    static std::string save_dom_to_string(
    xmlctx* xctx, xmlnode* root,
    bool add_xmldecl = true,
    ub4 indent_step = 2,
    ub4 indent_level = 0,
    bool prune_children = false,
    const char* eol = "\n"
    xmlerr err = XMLERR_OK;
    const ub4 max_len = 2048;
    oratext doc_string[max_len] = {0};
    boolean xmldecl = add_xmldecl? TRUE: FALSE;
    boolean prune = prune_children? TRUE: FALSE;
    const ubig_ora byte_count = myXmlSaveDom(
    xctx, &err, root,
    "buffer", doc_string,
    "buffer_length", max_len,
    "xmldecl", xmldecl, // ignored
    "prune", prune,
    // Using UTF-16 yields an empty string.
    // Using AL32UTF8 adds XML decl previously missing (with encoding="UTF-8")
    // despite requesting no xmldecl explicitly (was ignored anyway...), but
    // only if passing the doc node, not the root node.
    "output_encoding", "AL32UTF8",
    //"eol", eol, // LPX-00019: property "eol" unknown
    "indent_step", indent_step,
    "indent_level", indent_level, // ignored
    NULL // sentinel marking end of key/value pairs
    // Number of bytes written not returned, as advertised.
    // So deduce silent truncation from the end of the string
    // (nor is err set to XMLERR_SAVE_OVERFLOW...)
    const bool was_truncated = doc_string[max_len - 1] == '\0'
    && doc_string[max_len - 2] != '\0';
    const size_t actual_len = strlen((const char*)doc_string);
    cout << "byte_count return = " << byte_count
    << "; actual length = " << actual_len
    << "; truncated = " << (was_truncated? "true": "false")
    << endl;
    if (err == XMLERR_OK && actual_len > 0) {
    if (was_truncated) {
    cerr << "Truncation during XML serialization to a string" << endl;
    return std::string((const char*)doc_string, actual_len);
    return std::string();
    static void xml_dom_basics_main(int argc, const char* argv[]) {
    SystemTimer* disconnect_timer; // time "shutdown"
    Environment env(OCI_OBJECT);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    // TODO: Manipulate XML context???
    // FIXME: Instant Client SDK does not ship with xml.h...
    // Following call compiles (because include xmlotn.h) but doesn't link
    // with Instant Client SDK, because oci.dll doesn't export this symbol.
    //const boolean is_unicode = XmlIsUnicode(xctx);
    ** Same issue here, XmlLoadDom not available from oci.dll...
    // Parse "dummy" document
    xmlerr err = XMLERR_OK;
    oratext doc_string[] = "<dummy/>";
    xmldocnode* doc = XmlLoadDom(
    xctx, &err,
    "buffer", doc_string,
    "buffer_length", sizeof(doc_string)-1,
    "validate", TRUE,
    NULL // sentinel indicating last key/value pair
    if (!doc) {
    cerr << "XML parsing failed: rc = " << err << endl;
    // Only calls which are defined in xmlproc.h (in xdb/include) as
    // #define XmlXYZ which take an xctx as first param, and cast back
    // xctx into xmlctxhead, then access the struct of function pointers,
    // are accessible to a pure OCI / Instance Client app.
    oratext* dummy_root = 0;//[] = "dummy";
    oratext* dummy_uri = 0;
    xmldtdnode* dummy_dtd = 0;
    xmlerr err = XMLERR_OK;
    xmldocnode* doc = XmlCreateDocument(
    xctx, dummy_uri, dummy_root, dummy_dtd, &err
    if (!doc) {
    cerr << "XML parsing failed: rc = " << err << endl;
    } else {
    oratext root_tag[] = "root";
    xmlelemnode* root = XmlDomCreateElem(xctx, doc, root_tag);
    XmlDomAppendChild(xctx, doc, root);
    oratext child_tag[] = "child";
    xmlelemnode* child = XmlDomCreateElem(xctx, doc, child_tag);
    XmlDomAppendChild(xctx, root, child);
    xmltextnode* text = XmlDomCreateText(xctx, doc, (oratext*)"foo");
    XmlDomAppendChild(xctx, child, text);
    // Add a second child, but without text
    child = XmlDomCreateElem(xctx, doc, child_tag);
    XmlDomAppendChild(xctx, root, child);
    xmlelemnode* root2 = XmlDomGetDocElem(xctx, doc);
    assert(root == root2);
    xmlnodelist* children = XmlDomGetElemsByTag(
    xctx, root, (oratext*)"child"
    ub4 child_count = XmlDomGetNodeListLength(xctx, children);
    if (child_count > 0) {
    xmlnode* child0 = XmlDomGetNodeListItem(xctx, children, 0);
    if (XmlDomHasChildNodes(xctx, child0)) {
    // I assume it's text
    xmlnode* text0 = XmlDomGetFirstChild(xctx, child0);
    const oratext* value = XmlDomGetNodeValue(xctx, text0);
    ub4 value2_length = 0;
    const oratext* value2 = XmlDomGetNodeValueLen(xctx, text0, 0, 0, &value2_length);
    cout << "value = " << value << "; #value2 = " << value2_length << endl;
    XmlDomFreeNodeList(xctx, children);
    oratext doc_string[2048];
    const ubig_ora byte_count =
    (*XML_CB(xctx)->XML_SAVE_DOM_VA_CB)(
    //XmlSaveDomVA(
    xctx, &err, root,
    "buffer", doc_string,
    "buffer_length", 2048,//sizeof(doc_string) - 1,
    NULL
    cout << "byte_count = " << byte_count << endl;
    if (err == XMLERR_OK && byte_count > 0) {
    doc_string[sizeof(doc_string) - 1] = '\0'; // just in case
    cout << "doc = \n" << doc_string << endl;
    const std::string root_string = save_dom_to_string(xctx, root);
    cout << "root = \n" << root_string << endl;
    const std::string doc_string = save_dom_to_string(xctx, doc, false, 2, 2, false, "\r\n");
    cout << "doc = \n" << doc_string << endl;
    xmldocnode* doc2 = load_dom_from_string(
    xctx, doc_string.c_str(), (ub4)doc_string.size()
    const std::string doc_string2 = save_dom_to_string(xctx, doc2);
    cout << "doc2 = \n" << doc_string2 << endl;
    XmlFreeDocument(xctx, doc);
    XmlFreeDocument(xctx, doc2);
    // Try accessing freed doc on purpose (Hmmm, works...)
    //const std::string doc_string3 = save_dom_to_string(xctx, doc2);
    //cout << "doc3 = \n" << doc_string3 << endl;
    // 28 KB file. If file doesn't exist, simply prints out an error
    cout << "\n\n===== Loading / parsing 28 KB XML file =====" << endl;
    xmldocnode* xsd = load_dom_from_file(xctx, "georaster.xsd");
    cout << "XSD = \n" << save_dom_to_string(xctx, xsd, false, 2, 2, true, "\r\n");
    XmlFreeDocument(xctx, xsd);
    // 1,870 KB
    cout << "\n\n===== Loading / parsing 1,870 KB XML file =====" << endl;
    xmldocnode* witsml1 = load_dom_from_file(
    xctx, "medium.xml"
    cout << "WITSML1 = \n" << save_dom_to_string(xctx, witsml1, false, 2, 2, true);
    XmlFreeDocument(xctx, witsml1);
    // 68,911 KB
    cout << "\n\n===== Loading / parsing 68,911 KB XML file =====" << endl;
    xmldocnode* witsml2 = load_dom_from_file(
    xctx, "big.xml"
    cout << "WITSML2 = \n" << save_dom_to_string(xctx, witsml2, false, 2, 2, true);
    XmlFreeDocument(xctx, witsml2);
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_basics_main: " << timer << endl;
    // For some reason, disconnecting after reading a large XML file
    // is very slow... Loading the 68 MB file above, in about 8 seconds,
    // results in the shutdown to take around 28 seconds!!!
    disconnect_timer = new SystemTimer; // time "shutdown"
    cout << "\n\nDisconnecting from DB, terminating OCI environment... " << endl;
    cout << "'shutdown' time: " << *disconnect_timer << endl;
    delete disconnect_timer;
    template <class T> T* checkxml(T* node, xmlerr err) {
    xmlnode* xml_node = node;
    if (!xml_node) {
    throw std::runtime_error("null node");
    if (err != XMLERR_OK) {
    throw std::runtime_error("XML error code returned");
    return node;
    static void xml_dom_select_main(int argc, const char* argv[]) {
    const oratext charset[] = "AL32UTF8";
    Environment env(OCI_OBJECT, charset, charset);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    throw std::runtime_error("Cannot initialize XML context");
    // Allocate Statement Handle
    OCIStmt* selecthp = 0;
    checkerr(
    OCIHandleAlloc(
    (dvoid *) env.envhp, (dvoid **) &selecthp,
    OCI_HTYPE_STMT, 0, 0
    env.errhp
    // Prepare Statement
    const char *const sql = "SELECT id, doc FROM xml_tab";
    checkerr(
    OCIStmtPrepare(
    selecthp, env.errhp,
    (const OraText*)sql, (ub4) strlen(sql),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT
    env.errhp
    // Defines
    ub4 id = 0;
    OCIDefine* define_id = 0;
    checkerr(
    OCIDefineByPos(
    selecthp, &define_id, env.errhp, 1, &id, sizeof(id), SQLT_UIN,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT
    env.errhp
    OCIDefine* define_doc = 0;
    checkerr(
    OCIDefineByPos(
    selecthp, &define_doc, env.errhp, 2, 0, sizeof(point_typ), SQLT_NTY,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT
    env.errhp
    OCIType* xmltype_tdo = 0;
    const oratext xmltype_name[] = "XMLTYPE";
    checkerr(
    OCITypeByName(
    env.envhp, env.errhp, env.svchp,
    0, 0, // schema name (default schema when 0)
    xmltype_name, (ub4)strlen((const char*)xmltype_name),
    0, 0, // version name (ignored)
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &xmltype_tdo // connection (service specific)
    env.errhp
    xmldocnode* doc = 0;
    ub4 doc_size = 0;
    OCIInd* p_doc_ind = 0;
    ub4 doc_ind_size = 0;//(ub4)sizeof(point_ind);
    checkerr(
    OCIDefineObject(
    define_doc, env.errhp, xmltype_tdo,
    //(void**)&p_pt, &pt_size, (void**)&p_pt_ind, &pt_ind_size
    (void**)&doc, 0, (void**)&p_doc_ind, 0
    env.errhp
    // Execute (scalar) Select Statement
    checkerr(
    OCIStmtExecute(
    env.svchp, selecthp, env.errhp, (ub4) 0 /* specific to select... */, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT
    env.errhp,
    OCI_NO_DATA // TODO: Test with a select that returns no rows,
    // and specifying 0 iters, to see if it returns
    // OCI_SUCCESS, or OCI_NO_DATA
    // TODO: Describe the select-list.
    // TODO: Fix this screwed up logic!
    sword fetch_rc = OCI_NO_DATA;
    size_t row_count = 0;
    do {
    checkerr(
    fetch_rc = OCIStmtFetch2(
    selecthp, env.errhp, (ub4)1,
    (ub2)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT
    env.errhp, OCI_NO_DATA
    if (fetch_rc != OCI_NO_DATA) {
    ++row_count;
    if (p_doc_ind && *p_doc_ind == OCI_IND_NULL) {
    cerr << "\nXML doc#" << id << " is NULL" << endl;
    continue;
    cout << "\nXML doc#" << id << ":\n" << save_dom_to_string(xctx, doc) << endl;
    while (fetch_rc != OCI_NO_DATA);
    if (doc != NULL) {
    // When last row contained no document (NULL in XMLTYPE column),
    // the doc pointer is somehow reset to 0, and OCIObjectFree complains
    // about it: OCI-21560: argument 3 is null, invalid, or out of range
    checkerr(
    OCIObjectFree(env.envhp, env.errhp, doc, 0),
    env.errhp
    // Necessary to free documents when selecting XMLTYPE,
    // sinced used OCIObjectFree above?
    //XmlFreeDocument(xctx, doc);
    // Free Statement Handle
    checkerr(
    OCIHandleFree(selecthp, OCI_HTYPE_STMT),
    env.errhp
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_select_main: " << timer << endl;
    static void xml_dom_insert_main(int argc, const char* argv[]) {
    Environment env(OCI_OBJECT);
    env.connect(zusername, zpassword, zdatabase);
    SystemTimer timer; // don't time connecting to DB
    OCIError*const errhp = env.errhp;
    xmlctx*const xctx = OCIXmlDbInitXmlCtx(
    env.envhp, env.svchp, errhp,
    (ocixmldbparam *)0, 0
    if (!xctx) {
    checkerr(OCI_ERROR, errhp);
    throw std::runtime_error("Cannot initialize XML context");
    xmlerr err = XMLERR_OK;
    xmldocnode* doc = checkxml(XmlCreateDocument(xctx, 0, 0, 0, &err), err);
    xmlelemnode* root = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"root"), err);
    XmlDomAppendChild(xctx, doc, root);
    xmlattrnode* version = checkxml(XmlDomCreateAttr(xctx, doc, (oratext*)"version", (oratext*)"0.1"), err);
    XmlDomAppendChild(xctx, root, version);
    xmlelemnode* child = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"child"), err);
    XmlDomAppendChild(xctx, root, child);
    xmltextnode* text = checkxml(XmlDomCreateText(xctx, doc, (oratext*)"baz"), err);
    XmlDomAppendChild(xctx, child, text);
    // Add a second child, but without text
    child = checkxml(XmlDomCreateElem(xctx, doc, (oratext*)"child"), err);
    XmlDomAppendChild(xctx, root, child);
    xmlattrnode* empty = checkxml(XmlDomCreateAttr(xctx, doc, (oratext*)"empty", (oratext*)"true"), err);
    XmlDomAppendChild(xctx, child, empty);
    const std::string doc_string = save_dom_to_string(xctx, doc);
    cout << "doc = \n" << doc_string << endl;
    // Insert this document into the DB
    // Allocate Statement Handle
    OCIStmt* selecthp = 0;
    checkerr(
    OCIHandleAlloc(
    (dvoid *) env.envhp, (dvoid **) &selecthp,
    OCI_HTYPE_STMT, 0, 0
    env.errhp
    // Prepare Statement
    const char *const sql = "INSERT INTO xml_tab (id, doc) VALUES (:1, :2)";
    checkerr(
    OCIStmtPrepare(
    selecthp, env.errhp,
    (const OraText*)sql, (ub4) strlen(sql),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT
    env.errhp
    // Binds
    ub4 id = 101;
    OCIBind* bind_id = 0;
    checkerr(
    OCIBindByPos(
    selecthp, &bind_id, env.errhp, 1, &id, sizeof(id), SQLT_UIN,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT
    env.errhp
    OCIBind* bind_doc = 0;
    checkerr(
    OCIBindByPos(
    selecthp, &bind_doc, env.errhp, 2, 0, sizeof(point_typ), SQLT_NTY,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT
    env.errhp
    OCIType* xmltype_tdo = 0;
    const oratext xmltype_name[] = "XMLTYPE";
    checkerr(
    OCITypeByName(
    env.envhp, env.errhp, env.svchp,
    0, 0, // schema name (default schema when 0)
    xmltype_name, (ub4)strlen((const char*)xmltype_name),
    0, 0, // version name (ignored)
    OCI_DURATION_SESSION,
    OCI_TYPEGET_ALL,
    &xmltype_tdo // connection (service specific)
    env.errhp
    //xmldocnode* doc = 0;
    ub4 doc_size = 0;
    OCIInd doc_ind = OCI_IND_NOTNULL;
    OCIInd* p_doc_ind = &doc_ind;
    ub4 doc_ind_size = 0;//(ub4)sizeof(point_ind);
    checkerr(
    OCIBindObject(
    bind_doc, env.errhp, xmltype_tdo,
    //(void**)&p_pt, &pt_size, (void**)&p_pt_ind, &pt_ind_size
    (void**)&doc, 0, (void**)&p_doc_ind, 0
    env.errhp
    // Execute (scalar) Select Statement
    checkerr(
    OCIStmtExecute(
    env.svchp, selecthp, env.errhp, (ub4) 1, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT
    env.errhp,
    OCI_NO_DATA // TODO: Test with a select that returns no rows,
    // and specifying 0 iters, to see if it returns
    // OCI_SUCCESS, or OCI_NO_DATA
    // Commit transaction
    checkerr(
    OCITransCommit(env.svchp, env.errhp, 0),
    env.errhp
    XmlFreeDocument(xctx, doc);
    OCIXmlDbFreeXmlCtx(xctx);
    cout << "xml_dom_insert_main: " << timer << endl;
    </tt>

Maybe you are looking for