Make final fix for bug 74786 (String cleanup) easier by simplifying the Transformiix DOM. r=sicking, sr=jst. r=Pike on the parts not part of the Mozilla build.

git-svn-id: svn://10.0.0.236/trunk@136033 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%netscape.com 2003-01-09 00:15:55 +00:00
parent 0f7567ac4d
commit eac8a17309
14 changed files with 0 additions and 1119 deletions

View File

@ -1,85 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
* Contributor(s): Tom Kneeland
* Peter Van der Beken <peter.vanderbeken@pandora.be>
*
*/
/**
* Implementation of the wrapper class to convert the Mozilla nsIDOMDocumentType
* interface into a TransforMIIX DocumentType interface.
*/
#include "mozilladom.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMNotation.h"
/**
* Construct a wrapper with the specified Mozilla object and document owner.
*
* @param aDocumentType the nsIDOMDocumentType you want to wrap
* @param aOwner the document that owns this object
*/
DocumentType::DocumentType(nsIDOMDocumentType* aDocumentType, Document* aOwner):
Node(aDocumentType, aOwner)
{
}
/**
* Destructor
*/
DocumentType::~DocumentType()
{
}
/**
* Call nsIDOMDocumentType::GetEntities to get the entities of the document
* type.
*
* @return the entities of the document type
*/
NamedNodeMap* DocumentType::getEntities()
{
NSI_FROM_TX(DocumentType);
nsCOMPtr<nsIDOMNamedNodeMap> tmpEntities;
nsDocumentType->GetEntities(getter_AddRefs(tmpEntities));
if (!tmpEntities) {
return nsnull;
}
return mOwnerDocument->createNamedNodeMap(tmpEntities);
}
/**
* Call nsIDOMDocumentType::GetNotations to get the notations of the document
* type.
*
* @return the notations of the document type
*/
NamedNodeMap* DocumentType::getNotations()
{
NSI_FROM_TX(DocumentType);
nsCOMPtr<nsIDOMNamedNodeMap> notations;
nsDocumentType->GetNotations(getter_AddRefs(notations));
if (!notations) {
return nsnull;
}
return mOwnerDocument->createNamedNodeMap(notations);
}

View File

@ -1,85 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
* Contributor(s): Tom Kneeland
* Peter Van der Beken <peter.vanderbeken@pandora.be>
*
*/
/**
* Implementation of the wrapper class to convert the Mozilla nsIDOMEntity
* interface into a TransforMIIX Entity interface.
*/
#include "mozilladom.h"
#include "nsIDOMEntity.h"
/**
* Construct a wrapper with the specified Mozilla object and document owner.
*
* @param aEntity the nsIDOMElement you want to wrap
* @param aOwner the document that owns this object
*/
Entity::Entity(nsIDOMEntity* aEntity, Document* aOwner) : Node (aEntity, aOwner)
{
}
/**
* Destructor
*/
Entity::~Entity()
{
}
/**
* Call nsIDOMElement::GetPublicId to retrieve the public id for this entity.
*
* @return the entity's public id
*/
const String& Entity::getPublicId()
{
NSI_FROM_TX(Entity);
nsEntity->GetPublicId(publicId);
return publicId;
}
/**
* Call nsIDOMElement::GetSystemId to retrieve the system id for this entity.
*
* @return the entity's system id
*/
const String& Entity::getSystemId()
{
NSI_FROM_TX(Entity);
nsEntity->GetSystemId(systemId);
return systemId;
}
/**
* Call nsIDOMElement::GetNotationName to retrieve the notation name for this
* entity.
*
* @return the entity's system id
*/
const String& Entity::getNotationName()
{
NSI_FROM_TX(Entity);
nsEntity->GetNotationName(notationName);
return notationName;
}

View File

@ -1,81 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
* Contributor(s): Tom Kneeland
* Peter Van der Beken <peter.vanderbeken@pandora.be>
*
*/
/**
* Implementation of the wrapper class to convert the Mozilla nsIDOMNodeList
* interface into a TransforMIIX NodeList interface.
*/
#include "mozilladom.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
/**
* Construct a wrapper with the specified Mozilla object and document owner.
*
* @param aNodeList the nsIDOMNodeList you want to wrap
* @param aOwner the document that owns this object
*/
NodeList::NodeList(nsIDOMNodeList* aNodeList, Document* aOwner) :
MozillaObjectWrapper(aNodeList, aOwner)
{
}
/**
* Destructor
*/
NodeList::~NodeList()
{
}
/**
* Call nsIDOMNodeList::Item to the child at the specified index.
*
* @param aIndex the index of the child you want to get
*
* @return the child at the given index or NULL if there is none
*/
Node* NodeList::item(PRUint32 aIndex)
{
NSI_FROM_TX(NodeList);
nsCOMPtr<nsIDOMNode> node;
nsNodeList->Item(aIndex, getter_AddRefs(node));
if (!node) {
return nsnull;
}
return mOwnerDocument->createWrapper(node);
}
/**
* Call nsIDOMNodeList::GetLength to get the number of nodes.
*
* @return the number of nodes
*/
PRUint32 NodeList::getLength()
{
NSI_FROM_TX(NodeList);
PRUint32 length = 0;
nsNodeList->GetLength(&length);
return length;
}

View File

@ -1,73 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
* Contributor(s): Tom Kneeland
* Peter Van der Beken <peter.vanderbeken@pandora.be>
*
*/
/**
* Implementation of the wrapper class to convert the Mozilla nsIDOMNotation
* interface into a TransforMIIX Notation interface.
*/
#include "mozilladom.h"
#include "nsIDOMNotation.h"
/**
* Construct a wrapper with the specified Mozilla object and document owner.
*
* @param aCharData the nsIDOMNotation you want to wrap
* @param aOwner the document that owns this object
*/
Notation::Notation(nsIDOMNotation* aNotation, Document* aOwner) :
Node(aNotation, aOwner)
{
}
/**
* Destructor
*/
Notation::~Notation()
{
}
/**
* Call nsIDOMNotation::GetPublicId to retrieve the public id for this notation.
*
* @return the notation's public id
*/
const String& Notation::getPublicId()
{
NSI_FROM_TX(Notation);
nsNotation->GetPublicId(publicId);
return publicId;
}
/**
* Call nsIDOMNotation::GetSystemId to retrieve the system id for this notation.
*
* @return the notation's system id
*/
const String& Notation::getSystemId()
{
NSI_FROM_TX(Notation);
nsNotation->GetSystemId(systemId);
return systemId;
}

View File

@ -1,64 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the CDATASection class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
CDATASection::CDATASection(const String& theData, Document* owner) :
Text(Node::CDATA_SECTION_NODE, String(NS_LITERAL_STRING("#cdata-section")), theData, owner)
{
}
//
//CDATASection nodes can not have any children, so just return null from all child
//manipulation functions.
//
Node* CDATASection::insertBefore(Node* newChild, Node* refChild)
{
return NULL;
}
Node* CDATASection::replaceChild(Node* newChild, Node* oldChild)
{
return NULL;
}
Node* CDATASection::removeChild(Node* oldChild)
{
return NULL;
}
Node* CDATASection::appendChild(Node* newChild)
{
return NULL;
}

View File

@ -1,113 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the CharacterData class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Protected constructor. Just pass parameters onto NodeDefinition.
//
CharacterData::CharacterData(NodeType type, const String& name,
const String& value, Document* owner) :
NodeDefinition(type, name, value, owner)
{
}
//
//Return a constant reference to the data stored by this object.
//
const String& CharacterData::getData() const
{
return nodeValue;
}
//
//Set the data stored by this object to the string represented by "source".
//
void CharacterData::setData(const String& source)
{
nodeValue = source;
}
//
//Returns the length of the data object.
//
PRUint32 CharacterData::getLength() const
{
return nodeValue.Length();
}
//
//Retreive the substring starting at offset anc ending count number of
//characters away.
// NOTE: An empty string will be returned in the event of an error.
//
String& CharacterData::substringData(PRUint32 offset, PRUint32 count, String& dest)
{
if ((offset < nodeValue.Length()) && (count > 0))
return nodeValue.subString(offset, offset+count, dest);
else
{
dest.Truncate();
return dest;
}
}
void CharacterData::appendData(const String& arg)
{
nodeValue.Append(arg);
}
void CharacterData::insertData(PRUint32 offset, const String& arg)
{
if (offset < nodeValue.Length())
nodeValue.insert(offset, arg);
}
void CharacterData::deleteData(PRUint32 offset, PRUint32 count)
{
if ((offset < nodeValue.Length()) && (count > 0))
nodeValue.Cut(offset, count);
}
void CharacterData::replaceData(PRUint32 offset, PRUint32 count, const String& arg)
{
String tempString;
if ((offset < nodeValue.Length()) && (count > 0))
{
if (count < arg.Length())
{
tempString = arg.subString(0, count, tempString);
nodeValue.replace(offset, tempString);
}
else
nodeValue.replace(offset, arg);
}
}

View File

@ -1,64 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the Comment class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
Comment::Comment(const String& theData, Document* owner) :
CharacterData(Node::COMMENT_NODE, String(NS_LITERAL_STRING("#comment")), theData, owner)
{
}
//
//Comment nodes can not have any children, so just return null from all child
//manipulation functions.
//
Node* Comment::insertBefore(Node* newChild, Node* refChild)
{
return NULL;
}
Node* Comment::replaceChild(Node* newChild, Node* oldChild)
{
return NULL;
}
Node* Comment::removeChild(Node* oldChild)
{
return NULL;
}
Node* Comment::appendChild(Node* newChild)
{
return NULL;
}

View File

@ -1,55 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the DOMImplementation class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
DOMImplementation::DOMImplementation() : implFeature(NS_LITERAL_STRING("XML")),
implVersion(NS_LITERAL_STRING("1.0"))
{
}
DOMImplementation::~DOMImplementation()
{
}
//
//Perform a case insensitive comparison between "feature" and the
//functionality of this DOM implementation/version.
//
MBool DOMImplementation::hasFeature(String feature,
const String& version) const
{
feature.toUpperCase();
if (feature.Equals(implFeature) && version.Equals(implVersion))
return MB_TRUE;
else
return MB_FALSE;
}

View File

@ -1,68 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the DocumentFragment class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
// LF 08/06/1999 fixed typo: defalut to default
//
#include "dom.h"
//
//Construct a DocumentFragment with the specified name and value. Call the
//constructor for NodeDefinition and specify the DocumentFragment Type.
//
DocumentFragment::DocumentFragment(const String& name,
const String& value, Document* owner) :
NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, name, value, owner)
{
}
//
//First check to see if the new node is an allowable child for a
//DocumentFragment. If it is, call NodeDefinition's implementation of Insert
//Before. If not, return null as an error.
//
Node* DocumentFragment::insertBefore(Node* newChild, Node* refChild)
{
Node* returnVal = NULL;
switch (newChild->getNodeType())
{
case Node::ELEMENT_NODE :
case Node::PROCESSING_INSTRUCTION_NODE :
case Node::COMMENT_NODE :
case Node::TEXT_NODE :
case Node::CDATA_SECTION_NODE :
case Node::ENTITY_REFERENCE_NODE:
returnVal = NodeDefinition::insertBefore(newChild, refChild);
break;
default:
returnVal = NULL;
}
return returnVal;
}

View File

@ -1,96 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the DocumentType class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
DocumentType::DocumentType(const String& name, NamedNodeMap* theEntities,
NamedNodeMap* theNotations) :
NodeDefinition(Node::DOCUMENT_TYPE_NODE, name, NULL_STRING, NULL)
{
entities = theEntities;
notations = theNotations;
}
//
//When destroying the DocumentType, the entities and notations must be
//destroyed too.
//
DocumentType::~DocumentType()
{
if (entities)
delete entities;
if (notations)
delete notations;
}
//
//Return a pointer to the entities contained in this Document Type
//
NamedNodeMap* DocumentType::getEntities()
{
return entities;
}
//
//Return a pointer to the notations contained in this Document Type
//
NamedNodeMap* DocumentType::getNotations()
{
return notations;
}
//
//Comment nodes can not have any children, so just return null from all child
//manipulation functions.
//
Node* DocumentType::insertBefore(Node* newChild, Node* refChild)
{
return NULL;
}
Node* DocumentType::replaceChild(Node* newChild, Node* oldChild)
{
return NULL;
}
Node* DocumentType::removeChild(Node* oldChild)
{
return NULL;
}
Node* DocumentType::appendChild(Node* newChild)
{
return NULL;
}

View File

@ -1,95 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the Entity class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
// LF 08/06/1999 fixed typo: defalut to default
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
Entity::Entity(const String& name, const String& pubID,
const String& sysID, const String& notName) :
NodeDefinition(Node::ENTITY_NODE, name, NULL_STRING, NULL)
{
publicId = pubID;
systemId = sysID;
notationName = notName;
}
//
//Return the Public ID of the Entity
//
const String& Entity::getPublicId() const
{
return publicId;
}
//
//Return the System ID of the Entity
//
const String& Entity::getSystemId() const
{
return systemId;
}
//
//Return the Notation Name of the Entity
//
const String& Entity::getNotationName() const
{
return notationName;
}
//
//First check to see if the new node is an allowable child for an Entity. If
//it is, call NodeDefinition's implementation of Insert Before. If not, return
//null as an error.
//
Node* Entity::insertBefore(Node* newChild, Node* refChild)
{
Node* returnVal = NULL;
switch (newChild->getNodeType())
{
case Node::ELEMENT_NODE:
case Node::PROCESSING_INSTRUCTION_NODE:
case Node::COMMENT_NODE:
case Node::TEXT_NODE :
case Node::CDATA_SECTION_NODE:
case Node::ENTITY_REFERENCE_NODE:
returnVal = NodeDefinition::insertBefore(newChild, refChild);
break;
default:
returnVal = NULL;
}
return returnVal;
}

View File

@ -1,66 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the EntityReference class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
// LF 08/06/1999 fixed typo: defalut to default
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
EntityReference::EntityReference(const String& name, Document* owner) :
NodeDefinition(Node::ENTITY_REFERENCE_NODE, name, NULL_STRING, owner)
{
}
//
//First check to see if the new node is an allowable child for an
//EntityReference. If it is, call NodeDefinition's implementation of Insert
//Before. If not, return null as an error.
//
Node* EntityReference::insertBefore(Node* newChild, Node* refChild)
{
Node* returnVal = NULL;
switch (newChild->getNodeType())
{
case Node::ELEMENT_NODE:
case Node::PROCESSING_INSTRUCTION_NODE:
case Node::COMMENT_NODE:
case Node::TEXT_NODE :
case Node::CDATA_SECTION_NODE:
case Node::ENTITY_REFERENCE_NODE:
returnVal = NodeDefinition::insertBefore(newChild, refChild);
break;
default:
returnVal = NULL;
}
return returnVal;
}

View File

@ -1,81 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the Notation class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
Notation::Notation(const String& name, const String& pubID,
const String& sysID) :
NodeDefinition(Node::NOTATION_NODE, name, NULL_STRING, NULL)
{
publicId = pubID;
systemId = sysID;
}
//
//Return the Public ID of the Notation
//
const String& Notation::getPublicId() const
{
return publicId;
}
//Return the System ID of the Notation
const String& Notation::getSystemId() const
{
return systemId;
}
//
//Notation nodes can not have any children, so just return null from all child
//manipulation functions.
//
Node* Notation::insertBefore(Node* newChild, Node* refChild)
{
return NULL;
}
Node* Notation::replaceChild(Node* newChild, Node* oldChild)
{
return NULL;
}
Node* Notation::removeChild(Node* oldChild)
{
return NULL;
}
Node* Notation::appendChild(Node* newChild)
{
return NULL;
}

View File

@ -1,93 +0,0 @@
/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
// Tom Kneeland (3/29/99)
//
// Implementation of the Document Object Model Level 1 Core
// Implementation of the Text class
//
// Modification History:
// Who When What
// TK 03/29/99 Created
//
#include "dom.h"
//
//Construct a text object with the specified document owner and data
//
Text::Text(const String& theData, Document* owner) :
CharacterData(Node::TEXT_NODE, String(NS_LITERAL_STRING("#text")), theData, owner)
{
}
//
//Protected constructor for children of the Text Class. Currently only
//CDATASection needs to use this function.
Text::Text(NodeType type, const String& name, const String& value,
Document* owner) :
CharacterData(type, name, value, owner)
{
}
//
//Split the text node at Offset into two siblings. Return a pointer to the new
//sibling.
//
Text* Text::splitText(PRUint32 offset)
{
Text* newTextSibling = NULL;
String newData;
if (offset < nodeValue.Length())
{
newTextSibling = getOwnerDocument()->createTextNode(nodeValue.subString(offset, newData));
getParentNode()->insertBefore(newTextSibling, getNextSibling());
nodeValue.Cut(offset, nodeValue.Length() - offset);
}
return newTextSibling;
}
//
//Text nodes can not have any children, so just return null from all child
//manipulation functions.
//
Node* Text::insertBefore(Node* newChild, Node* refChild)
{
return NULL;
}
Node* Text::replaceChild(Node* newChild, Node* oldChild)
{
return NULL;
}
Node* Text::removeChild(Node* oldChild)
{
return NULL;
}
Node* Text::appendChild(Node* newChild)
{
return NULL;
}