gambas-source-code/gb.xml/src/CNode.cpp

292 lines
6.6 KiB
C++
Raw Normal View History

[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#include "element.h"
#include "CNode.h"
/*========== Node */
#undef THIS
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
#define THIS (static_cast<CNode*>(_object)->node)
BEGIN_METHOD_VOID(CNode_new)
if(Node::NoInstanciate) return;
THIS = 0;
END_METHOD
BEGIN_METHOD(CNode_toString, GB_BOOLEAN indent)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->toString((!MISSING(indent) && VARG(indent)) ? 0 : -1));
END_METHOD
BEGIN_PROPERTY(CNode_textContent)
if(READ_PROPERTY)
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return((THIS->textContent()));
}
else
{
THIS->setTextContent(PSTRING());
}
END_PROPERTY
#define NODE_BASE 0
#define NODE_ELEMENT 1
#define NODE_TEXT 2
#define NODE_COMMENT 3
#define NODE_CDATA 4
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
#define NODE_ATTRIBUTE 5
BEGIN_PROPERTY(CNode_type)
switch(THIS->getType())
{
case Node::ElementNode:
GB.ReturnInteger(NODE_ELEMENT);break;
case Node::Comment:
GB.ReturnInteger(NODE_COMMENT);break;
case Node::NodeText:
GB.ReturnInteger(NODE_TEXT);break;
case Node::CDATA:
GB.ReturnInteger(NODE_CDATA);break;
case Node::BaseNode:
default:
GB.ReturnInteger(NODE_BASE);
}
END_PROPERTY
BEGIN_PROPERTY(CNode_isElement)
GB.ReturnBoolean(THIS->isElement());
END_PROPERTY
BEGIN_PROPERTY(CNode_isText)
GB.ReturnBoolean(THIS->isText());
END_PROPERTY
BEGIN_PROPERTY(CNode_isComment)
GB.ReturnBoolean(THIS->isComment());
END_PROPERTY
BEGIN_PROPERTY(CNode_isCDATA)
GB.ReturnBoolean(THIS->isCDATA());
END_PROPERTY
BEGIN_PROPERTY(CNode_element)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->toElement());
END_PROPERTY
BEGIN_PROPERTY(CNode_ownerDoc)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->ownerDocument());
END_PROPERTY
BEGIN_PROPERTY(CNode_parent)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->getParent());
END_PROPERTY
BEGIN_PROPERTY(CNode_previous)
if(!READ_PROPERTY) return;
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->previous());
END_PROPERTY
BEGIN_PROPERTY(CNode_next)
if(!READ_PROPERTY) return;
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return(THIS->next());
END_PROPERTY
BEGIN_PROPERTY(CNode_name)
if(!READ_PROPERTY)
{
if(THIS->isElement())
{
THIS->toElement()->setTagName(PSTRING());
}
return;
}
switch (THIS->getType())
{
case Node::ElementNode:
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return((*(THIS->toElement()->tagName)));break;
case Node::NodeText:
GB.ReturnNewZeroString("#text");break;
case Node::Comment:
GB.ReturnNewZeroString("#comment");break;
case Node::CDATA:
GB.ReturnNewZeroString("#cdata");break;
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
case Node::Attribute:
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return((*(reinterpret_cast<AttrNode*>(THIS)->attrName)).c_str()); break;
case Node::BaseNode:
default:
GB.ReturnNull();
}
END_PROPERTY
BEGIN_METHOD(CNode_newElement, GB_STRING name; GB_STRING value)
if(!THIS->isElement()) return;
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
Element *elmt = new Element;
elmt->setTagName(STRING(name));
if(!MISSING(value)) elmt->setTextContent(STRING(value));
THIS->toElement()->appendChild(elmt);
END_METHOD
BEGIN_METHOD(CNode_setAttribute, GB_STRING attr; GB_STRING val)
if(!THIS->isElement()) return;
THIS->toElement()->setAttribute(STRING(attr), STRING(val));
END_METHOD
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
BEGIN_METHOD(CElementAttributes_get, GB_STRING name)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GBI::Return((THIS->toElement()->getAttribute(STRING(name))));
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
END_METHOD
BEGIN_METHOD(CElementAttributes_put, GB_STRING value; GB_STRING name)
THIS->toElement()->setAttribute(STRING(name), STRING(value));
END_METHOD
BEGIN_PROPERTY(CElementAttributes_count)
if(READ_PROPERTY)
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GB.ReturnInteger(THIS->toElement()->attributes->len);
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
}
END_PROPERTY
BEGIN_METHOD_VOID(CElementAttributes_next)
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
flist<AttrListElement*>::element *it = *reinterpret_cast<flist<AttrListElement*>::element**>((GB.GetEnum()));
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
if(it == 0)
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
it = THIS->toElement()->attributes->firstElement;
*reinterpret_cast<flist<AttrListElement*>::element**>(GB.GetEnum()) = it;
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
}
else
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
*reinterpret_cast<flist<AttrListElement*>::element**>(GB.GetEnum()) = it->next;
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
}
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
if(it == 0) {GB.StopEnum(); THIS->toElement()->attributeNode->attrName = 0; return;}
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
THIS->toElement()->attributeNode->setAttrName(*(it->value->attrName));
GBI::Return(THIS->toElement()->attributeNode);
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
END_METHOD
BEGIN_PROPERTY(CNode_attributes)
if(THIS->getType() == NODE_ELEMENT)
{
RETURN_SELF();
return;
}
GB.ReturnNull();
END_PROPERTY
GB_DESC CElementAttributesDesc[] =
{
GB_DECLARE(".XmlElementAttributes", 0), GB_VIRTUAL_CLASS(),
GB_METHOD("_get", "s", CElementAttributes_get, "(Name)s"),
GB_METHOD("_put", "s", CElementAttributes_put, "(Value)s(Name)s"),
GB_METHOD("_next", "XmlNode", CElementAttributes_next, ""),
GB_PROPERTY_READ("Count", "i", CElementAttributes_count),
GB_END_DECLARE
};
GB_DESC CElementAttributeNodeDesc[] =
{
GB_DECLARE("_XmlAttrNode", sizeof(AttrNode)), GB_INHERITS("XmlNode"),
GB_END_DECLARE
};
GB_DESC CNodeDesc[] =
{
[GB.XML] OPT : A few compilation optimizations in headers inclusions. OPT : Use of separated internal classes of gambas objects. This might prevent from a lot of problems. OPT : Strings are not stored as wchar_t* anymore, but as simple char*, and are converted only when necessary (like UTF8 characters verification). OPT : Does not use STL classes anymore. They are too slow. Uses now handmade classes. OPT : Nodes are now internally linked to their brothers, so it makes find them really fasters, and allows no longer use of external linked list. OPT : When creating new nodes, linked Gambas objects are created only when necessary, so it makes internals instanciations very faster (such as the parser). OPT : Handmade string/memory classes and functions are now separated from the main.cpp component file. OPT : Use specialized memory management functions (like memcpy, memchr ...) into the parser. They are really faster than C loops, and speeds up the parser for documents that have a lot of plain text. OPT : Internally, the stream parser (XmlReader) takes only one char, not a unuseful wole string object. OPT : Does not updates debugging data when parsing a file. They will be generated only if an error is raised (not implemented yet). It will allow a speedier parser and more precise informations. BUG : When loading a document from a file, now correctly releases the file data. BUG : Solved a few XmlReader uninitialized variables, that could make the stream parser crash or returns strange results. git-svn-id: svn://localhost/gambas/trunk@4737 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-05-17 22:49:54 +02:00
GB_DECLARE("XmlNode", sizeof(CNode)), GB_NOT_CREATABLE(),
GB_METHOD("_new", "", CNode_new, ""),
GB_CONSTANT("ElementNode", "i", NODE_ELEMENT),
GB_CONSTANT("TextNode", "i", NODE_TEXT),
GB_CONSTANT("CommentNode", "i", NODE_COMMENT),
GB_CONSTANT("CDATASectionNode", "i", NODE_CDATA),
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
GB_CONSTANT("AttributeNode", "i", NODE_ATTRIBUTE),
GB_PROPERTY_READ("Type", "i", CNode_type),
GB_PROPERTY_READ("IsElement", "b", CNode_isElement),
GB_PROPERTY_READ("IsText", "b", CNode_isText),
GB_PROPERTY_READ("IsComment", "b", CNode_isComment),
GB_PROPERTY_READ("IsCDATA", "b", CNode_isCDATA),
GB_PROPERTY_READ("Element", "XmlElement", CNode_element),
GB_PROPERTY_READ("OwnerDocument", "XmlDocument", CNode_ownerDoc),
GB_PROPERTY_READ("Parent", "XmlElement", CNode_parent),
GB_PROPERTY_READ("Previous", "XmlNode", CNode_previous),
GB_PROPERTY_READ("Next", "XmlNode", CNode_next),
GB_METHOD("ToString", "s", CNode_toString, "[(Indent)b]"),
GB_PROPERTY("TextContent", "s", CNode_textContent),
GB_PROPERTY("Value", "s", CNode_textContent),
GB_PROPERTY("Name", "s", CNode_name),
//Méthodes obsolètes
GB_METHOD("NewElement", "s", CNode_newElement, "(Name)s[(Value)s]"),
GB_METHOD("NewAttribute", "", CNode_setAttribute, "(Name)s(Value)s"),
[GB.XML] * NEW : Added a new property "State" to XmlExplorer and XmlReader, that allows to know the reader state, without knowing Read() return value. * NEW : When enumerating XmlReader.Node.Attributes, XmlReader.Node represents the current attribute. * NEW : Added an new method Open() that loads an HtmlDocument from a file and defines it as the document to read. * NEW : The Attributes property has now moved from XmlElement to XmlNode. XmlNode.Attributes returns Null if the node isn't an element. * NEW : Then enumeration of XmlNode.Attributes now returns an .XmlElementAttribute instead of a string. * NEW : The XmlNode.Attribute constant is not obsolete anymore. * NEW : Two consecutives whitespaces are now ignored (only one is preserved). * NEW : When parsing a file, line-breaks and tabulations are replaced by spaces. * BUG : XmlExplorer flags are now correctly initialized. * BUG : Added an Eof property on XmlExplorer, that was missing. * BUG : Calling XmlExplorer.Read() after Eof just returns XmlReaderNodeType.Eof, not more. * BUG : Calling XmlNode.Next() when the node hasn't got any brother after him doesn't crash anymore, it just returns Null. * BUG : Calling XmlElement.NextSibling() when the node hasn't got any element brother after him doesn't crash anymore, it just returns Null. * BUG : By default, XmlReader correctly stops when reading the end of an element. * BUG : XmlExplorer now correctly initializes and releases itself. * BUG : XmlExplorer now correctly supports its read flags. * OPT : Solved a memory leak when releasing a XmlReader. * OPT : When setting text content to a XmlNode, the string is not duplicated anymore. * OPT : When testing if characters are whitespaces or names characters while parsing texts, puts the temporary variable into registers instead of memory. git-svn-id: svn://localhost/gambas/trunk@4669 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2012-04-25 01:47:14 +02:00
GB_PROPERTY_READ("Attributes", ".XmlElementAttributes", CNode_attributes),
//Constantes obsolètes
GB_CONSTANT("EntityRefNode", "i", 0),
GB_CONSTANT("EntityNode", "i", 0),
GB_CONSTANT("PiNode", "i", 0),
GB_CONSTANT("DocumentNode", "i", 0),
GB_CONSTANT("DocumentTypeNode", "i", 0),
GB_CONSTANT("DocumentFragNode", "i", 0),
GB_CONSTANT("NotationNode", "i", 0),
GB_CONSTANT("HtmlDocumentNode", "i", 0),
GB_CONSTANT("DtdNode", "i", 0),
GB_CONSTANT("ElementDecl", "i", 0),
GB_CONSTANT("AttributeDecl", "i", 0),
GB_CONSTANT("EntityDecl", "i", 0),
GB_CONSTANT("NamespaceDecl", "i", 0),
GB_CONSTANT("XIncludeStart", "i", 0),
GB_CONSTANT("XIncludeEnd", "i", 0),
GB_CONSTANT("DocbDocumentNode", "i", 0),
GB_END_DECLARE
};