lsimpl.cpp revision 4cb9ed4c3d183554e888e636844f8e3c2e666c40
/**
* Phoebe DOM Implementation.
*
* This is a C++ approximation of the W3C DOM model, which follows
* fairly closely the specifications in the various .idl files, copies of
* which are provided for reference. Most important is this one:
*
*
* Authors:
* Bob Jamison
*
* Copyright (C) 2005-2007 Bob Jamison
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "domimpl.h"
#include "events.h"
#include "traversal.h"
#include "lsimpl.h"
#include <stdarg.h>
#include <cstdio>
namespace org
{
namespace w3c
{
namespace dom
{
namespace ls
{
/*#########################################################################
## LSParserImpl
#########################################################################*/
/**
*
*/
bool LSParserImpl::getBusy()
{
return false;
}
/**
*
*/
{
//#### Check the various inputs of 'input' in order, according
//# to the L&S spec
if (lsreader)
{
while (true)
{
if (ch < 0)
break;
}
return doc;
}
if (inputStream)
{
while (true)
{
if (ch < 0)
break;
}
return doc;
}
if (stringData.size() > 0)
{
return doc;
}
{
//lets not do this yet
return NULL;
}
{
//lets not do this yet
return NULL;
}
return NULL;
}
/**
*
*/
{
return NULL;
}
/**
*
*/
const NodePtr /*contextArg*/,
unsigned short /*action*/)
{
return NULL;
}
//##################
//# Non-API methods
//##################
/*#########################################################################
## LSSerializerImpl
#########################################################################*/
/**
*
*/
bool LSSerializerImpl::write(
const LSOutput &destination)
throw (LSException)
{
outbuf = "";
indent = 0;
//## Check in order specified in the L&S specs
if (writer)
{
{
}
return true;
}
if (outputStream)
{
{
}
return true;
}
{
//DO SOMETHING
return true;
}
return false;
}
/**
*
*/
throw(LSException)
{
outbuf = "";
indent = 0;
if (!f)
return false;
{
}
fclose(f);
return false;
}
/**
*
*/
{
outbuf = "";
indent = 0;
return outbuf;
}
//##################
//# Non-API methods
//##################
/**
*
*/
void LSSerializerImpl::spaces()
{
for (int i=0 ; i<indent ; i++)
{
}
}
/**
*
*/
{
char str[257];
}
{
}
{
{
if (ch == '&')
else if (ch == '<')
else if (ch == '>')
else if (ch == '"')
else if (ch == '\'')
else
}
}
/**
*
*/
{
switch (type)
{
//#############
//# DOCUMENT
//#############
case Node::DOCUMENT_NODE:
{
}
break;
//#############
//# TEXT
//#############
{
}
break;
//#############
//# CDATA
//#############
case Node::CDATA_SECTION_NODE:
{
pos("<![CDATA[");
pos("]]>");
}
break;
//#############
//# ELEMENT
//#############
case Node::ELEMENT_NODE:
{
indent+=2;
//### Start open tag
spaces();
po("<");
//if (nrAttrs>0)
// pos(newLine);
//### Attributes
for (int i=0 ; i<nrAttrs ; i++)
{
spaces();
po("=\"");
po("\"");
//pos(newLine);
}
//### Finish open tag
//if (nrAttrs>0)
// spaces();
po(">");
//pos(newLine);
//### Contents
//spaces();
//### Children
{
}
//### Close tag
//spaces();
po("</");
po(">");
indent-=2;
}
break;
}//switch
}
} //namespace ls
} //namespace dom
} //namespace w3c
} //namespace org
/*#########################################################################
## E N D O F F I L E
#########################################################################*/