[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Stream in C++

  • To: xml-dev@l...
  • Subject: XML Stream in C++
  • From: "Pijcke Christophe" <cpijcke@h...>
  • Date: Tue, 18 Dec 2001 20:06:56 +0100
  • Bcc:

xml stream c

Hello everyone,

I am rather new on this list, and I do not know all yet what relates to the 
I am still being studied, and I make my last year.  For three years that 
teatcher asks me to [expletive deleted] c++ code has length of day, and I start has to like 
this ...

What I love in this language, it is that when I require to make a program, I 
launch google, I will seek 60% of the code on all the projects existing 
under free licence and I do not have any more whom has to make some links to 
have my applications.
I have to try to use the library sax & dom, but I do not find them very 
I wondered thus why there was no XML stream.
For a c++ programmer, I think that it would be simpler to write a program 
which resembles has this:

class Book {
  char *_nom;

  friend oxstream& operator<<(oxstream&, const Book&);
  friend ixstream& operator>>(ixstream&, Book&);

  friend ostream& operator<<(ostream&, const Book&);
  friend istream& operator>>(istream&, Book&);

int main()
  ifxstream xmlfile("book.xml");
  tag t = xmlfile.getTag();
  Book bk;
  vector<Book> vBk;

  if(t != "INVENTAIRE")
    return 1;

  while( (t = xmlfile.getTag()) != "/INVENTAIRE") {
    xmlfile >> bk;

      return 2;


  for(vector<Book>::const_iterator p = vBk.begin(); p < vBk.end(); ++p)
    cout << *p << endl;

  return 0;

With this type of code, I can send a book, or all the books on a file, a 
socket, a pipe, or same in memory without problem.
It could y have (without too having still reflects has the question) a 
hierarchy of this type:

       (ios) -> xios  (for XML Input/Output Stream)
               /    \
              /      \
             /        \
        ixstream    oxstream
         /  |  \    /  |  \

       ...  (stream file, memory, socket, ...)

One beneficie thus of all the advantages of flows.

All this is the fruit of a dream which I has just made this night.
I thus do not have yet deep the question.

I would have just liked to know what you think of all this.


PS: Sorry for my verry bad english.
    Thank you http://www.netbel.be/translation/ for help me.

Discutez en ligne avec vos amis, essayez MSN Messenger : 


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.