[DEV] update some API ==> better normalisation
This commit is contained in:
parent
b1ea27a01a
commit
fce7d1d7ab
@ -1,6 +1,8 @@
|
|||||||
/** Basic module interface.
|
/** @file
|
||||||
*
|
* @author Edouard DUPIN
|
||||||
* @author Edouard DUPIN */
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
open module org.atriasoft.exml {
|
open module org.atriasoft.exml {
|
||||||
exports org.atriasoft.exml;
|
exports org.atriasoft.exml;
|
||||||
|
@ -1,33 +1,38 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @brief Single attribute element
|
* @brief Single attribute element
|
||||||
*/
|
*/
|
||||||
public class Attribute extends Node {
|
public class Attribute {
|
||||||
|
|
||||||
|
protected FilePos m_pos; //!< position in the read file (null if the file is not parsed);
|
||||||
|
protected String m_value; //!< value of the node (for element this is the name, for text it is the inside text ...);
|
||||||
protected String m_name; //!< Name of the attribute
|
protected String m_name; //!< Name of the attribute
|
||||||
|
|
||||||
public Attribute() {
|
public Attribute() {
|
||||||
super("");
|
this.m_pos = null;
|
||||||
|
this.m_value = "";
|
||||||
this.m_name = "";
|
this.m_name = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attribute(final Attribute _obj) {
|
public Attribute(final Attribute _obj) {
|
||||||
super(_obj.m_value);
|
this.m_pos = null;
|
||||||
this.m_pos = _obj.getPos().clone();
|
this.m_value = _obj.m_value;
|
||||||
this.m_name = _obj.m_name;
|
this.m_name = _obj.m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attribute(final String _name) {
|
public Attribute(final String _name) {
|
||||||
super("");
|
|
||||||
this.m_name = _name;
|
this.m_name = _name;
|
||||||
|
this.m_value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,19 +41,18 @@ public class Attribute extends Node {
|
|||||||
* @param[in] _value Value of the attribute.
|
* @param[in] _value Value of the attribute.
|
||||||
*/
|
*/
|
||||||
public Attribute(final String _name, final String _value) {
|
public Attribute(final String _name, final String _value) {
|
||||||
super(_value);
|
|
||||||
this.m_name = _name;
|
this.m_name = _name;
|
||||||
|
this.m_value = _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.m_name = "";
|
this.m_value = "";
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Attribute clone() {
|
public Attribute clone() {
|
||||||
return new Attribute(this);
|
return new Attribute(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current name of the Attribute
|
* @brief get the current name of the Attribute
|
||||||
@ -58,12 +62,14 @@ public class Attribute extends Node {
|
|||||||
return this.m_name;
|
return this.m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public NodeType getType() {
|
* @brief get the current element Value.
|
||||||
return NodeType.attribute;
|
* @return the reference of the string value.
|
||||||
}
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return this.m_value;
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||||
_data.append(" ");
|
_data.append(" ");
|
||||||
_data.append(this.m_name);
|
_data.append(this.m_name);
|
||||||
@ -71,18 +77,17 @@ public class Attribute extends Node {
|
|||||||
_data.append(this.m_value);
|
_data.append(this.m_value);
|
||||||
_data.append("\"");
|
_data.append("\"");
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||||
Log.verbose("start parse : 'attribute'");
|
Log.verbose("start parse : 'attribute'");
|
||||||
this.m_pos.set(_filePos);
|
this.m_pos = _filePos.clone();
|
||||||
// search end of the comment :
|
// search end of the comment :
|
||||||
int lastElementName = _pos.value;
|
int lastElementName = _pos.value;
|
||||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||||
_filePos.check(_data.charAt(iii));
|
_filePos.check(_data.charAt(iii));
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (checkAvaillable(_data.charAt(iii), false) == true) {
|
if (Tools.checkAvaillable(_data.charAt(iii), false) == true) {
|
||||||
lastElementName = iii;
|
lastElementName = iii;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
@ -94,7 +99,7 @@ public class Attribute extends Node {
|
|||||||
}
|
}
|
||||||
// count white space :
|
// count white space :
|
||||||
final FilePos tmpPos = new FilePos();
|
final FilePos tmpPos = new FilePos();
|
||||||
int white = countWhiteChar(_data, lastElementName + 1, tmpPos);
|
int white = Tools.countWhiteChar(_data, lastElementName + 1, tmpPos);
|
||||||
_filePos.add(tmpPos);
|
_filePos.add(tmpPos);
|
||||||
if (lastElementName + white + 1 >= _data.length()) {
|
if (lastElementName + white + 1 >= _data.length()) {
|
||||||
_doc.createError(_data, lastElementName + white + 1, _filePos, " parse an xml end with an attribute parsing...");
|
_doc.createError(_data, lastElementName + white + 1, _filePos, " parse an xml end with an attribute parsing...");
|
||||||
@ -104,7 +109,7 @@ public class Attribute extends Node {
|
|||||||
_doc.createError(_data, lastElementName + white + 1, _filePos, " error attribute parsing == > missing '=' ...");
|
_doc.createError(_data, lastElementName + white + 1, _filePos, " error attribute parsing == > missing '=' ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
white += countWhiteChar(_data, lastElementName + white + 2, tmpPos);
|
white += Tools.countWhiteChar(_data, lastElementName + white + 2, tmpPos);
|
||||||
_filePos.add(tmpPos);
|
_filePos.add(tmpPos);
|
||||||
|
|
||||||
if (lastElementName + white + 2 >= _data.length()) {
|
if (lastElementName + white + 2 >= _data.length()) {
|
||||||
@ -120,7 +125,7 @@ public class Attribute extends Node {
|
|||||||
_filePos.increment();
|
_filePos.increment();
|
||||||
int lastAttributePos = lastElementName + white + 2;
|
int lastAttributePos = lastElementName + white + 2;
|
||||||
for (int iii = lastElementName + white + 2; iii < _data.length(); iii++) {
|
for (int iii = lastElementName + white + 2; iii < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||||
_doc.createError(_data, iii, _filePos, "unexpected '\\n' in an attribute parsing");
|
_doc.createError(_data, iii, _filePos, "unexpected '\\n' in an attribute parsing");
|
||||||
return false;
|
return false;
|
||||||
@ -140,7 +145,7 @@ public class Attribute extends Node {
|
|||||||
}
|
}
|
||||||
int lastAttributePos = lastElementName + white + 3;
|
int lastAttributePos = lastElementName + white + 3;
|
||||||
for (int iii = lastElementName + white + 3; iii < _data.length(); iii++) {
|
for (int iii = lastElementName + white + 3; iii < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
_filePos.check(_data.charAt(iii));
|
_filePos.check(_data.charAt(iii));
|
||||||
if ((_data.charAt(iii) != '"' && simpleQuoteCase == false) || (_data.charAt(iii) != '\'' && simpleQuoteCase == true)) { // '
|
if ((_data.charAt(iii) != '"' && simpleQuoteCase == false) || (_data.charAt(iii) != '\'' && simpleQuoteCase == true)) { // '
|
||||||
lastAttributePos = iii + 1;
|
lastAttributePos = iii + 1;
|
||||||
@ -163,4 +168,12 @@ public class Attribute extends Node {
|
|||||||
public void setName(final String _name) {
|
public void setName(final String _name) {
|
||||||
this.m_name = _name;
|
this.m_name = _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief set the value of the node.
|
||||||
|
* @param[in] _value New value of the node.
|
||||||
|
*/
|
||||||
|
public final void setValue(final String _value) {
|
||||||
|
this.m_value = _value;
|
||||||
|
}
|
||||||
};
|
};
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @brief Comment node: lt;!-- ... --gt;
|
* @brief Comment node: lt;!-- ... --gt;
|
||||||
*/
|
*/
|
||||||
@ -35,12 +37,12 @@ public class Comment extends Node {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeType getType() {
|
public NodeType getType() {
|
||||||
return NodeType.comment;
|
return NodeType.COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean iGenerate(final StringBuilder _data, final int _indent) {
|
public boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||||
addIndent(_data, _indent);
|
Tools.addIndent(_data, _indent);
|
||||||
_data.append("<!--");
|
_data.append("<!--");
|
||||||
_data.append(this.m_value);
|
_data.append(this.m_value);
|
||||||
_data.append("-->\n");
|
_data.append("-->\n");
|
||||||
@ -52,11 +54,11 @@ public class Comment extends Node {
|
|||||||
Log.verbose("start parse : 'comment'");
|
Log.verbose("start parse : 'comment'");
|
||||||
this.m_pos = _filePos;
|
this.m_pos = _filePos;
|
||||||
final FilePos tmpPos = new FilePos();
|
final FilePos tmpPos = new FilePos();
|
||||||
final int white = countWhiteChar(_data, _pos.value, tmpPos);
|
final int white = Tools.countWhiteChar(_data, _pos.value, tmpPos);
|
||||||
_filePos.add(tmpPos);
|
_filePos.add(tmpPos);
|
||||||
// search end of the comment :
|
// search end of the comment :
|
||||||
for (int iii = _pos.value + white; iii + 2 < _data.length(); iii++) {
|
for (int iii = _pos.value + white; iii + 2 < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -65,7 +67,7 @@ public class Comment extends Node {
|
|||||||
// search whitespace :
|
// search whitespace :
|
||||||
int newEnd = iii;
|
int newEnd = iii;
|
||||||
for (int jjj = iii - 1; jjj > _pos.value; jjj--) {
|
for (int jjj = iii - 1; jjj > _pos.value; jjj--) {
|
||||||
if (isWhiteChar(_data.charAt(jjj)) == true) {
|
if (Tools.isWhiteChar(_data.charAt(jjj)) == true) {
|
||||||
newEnd = jjj;
|
newEnd = jjj;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @brief Declaration node: lt;?XXXXXX ... gt;
|
* @brief Declaration node: lt;?XXXXXX ... gt;
|
||||||
*/
|
*/
|
||||||
@ -37,12 +39,12 @@ public class Declaration extends AttributeList {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeType getType() {
|
public NodeType getType() {
|
||||||
return NodeType.declaration;
|
return NodeType.DECLARATION;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||||
addIndent(_data, _indent);
|
Tools.addIndent(_data, _indent);
|
||||||
_data.append("<?");
|
_data.append("<?");
|
||||||
_data.append(this.m_value);
|
_data.append(this.m_value);
|
||||||
super.iGenerate(_data, _indent);
|
super.iGenerate(_data, _indent);
|
||||||
@ -56,7 +58,7 @@ public class Declaration extends AttributeList {
|
|||||||
this.m_pos = _filePos;
|
this.m_pos = _filePos;
|
||||||
// search end of the comment :
|
// search end of the comment :
|
||||||
for (int iii = _pos.value; iii + 1 < _data.length(); iii++) {
|
for (int iii = _pos.value; iii + 1 < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -71,7 +73,7 @@ public class Declaration extends AttributeList {
|
|||||||
_pos.value = iii + 1;
|
_pos.value = iii + 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (checkAvaillable(_data.charAt(iii), true) == true) {
|
if (Tools.checkAvaillable(_data.charAt(iii), true) == true) {
|
||||||
// we find an attibute == > create an element and parse it:
|
// we find an attibute == > create an element and parse it:
|
||||||
final Attribute attribute = new Attribute();
|
final Attribute attribute = new Attribute();
|
||||||
_pos.value = iii;
|
_pos.value = iii;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
@ -11,22 +18,6 @@ import org.atriasoft.exml.internal.Log;
|
|||||||
* @brief Basic document element of a document
|
* @brief Basic document element of a document
|
||||||
*/
|
*/
|
||||||
public class Document extends Element {
|
public class Document extends Element {
|
||||||
private static String createPosPointer(final String _line, final int _pos) {
|
|
||||||
String out = "";
|
|
||||||
int iii;
|
|
||||||
for (iii = 0; iii < _pos && iii < _line.length(); iii++) {
|
|
||||||
if (_line.charAt(iii) == '\t') {
|
|
||||||
out += "\t";
|
|
||||||
} else {
|
|
||||||
out += " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (; iii < _pos; iii++) {
|
|
||||||
out += " ";
|
|
||||||
}
|
|
||||||
out += "^";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean m_caseSensitive; //!< check the case sensitive of the nodes and attribute
|
private boolean m_caseSensitive; //!< check the case sensitive of the nodes and attribute
|
||||||
private boolean m_writeErrorWhenDetexted; //!< Request print error in parsing just when detected
|
private boolean m_writeErrorWhenDetexted; //!< Request print error in parsing just when detected
|
||||||
@ -84,7 +75,7 @@ public class Document extends Element {
|
|||||||
Log.error("No error detected ???");
|
Log.error("No error detected ???");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.error(this.m_filePos + " " + this.m_comment + "\n" + this.m_Line + "\n" + createPosPointer(this.m_Line, this.m_filePos.getCol()));
|
Log.error(this.m_filePos + " " + this.m_comment + "\n" + this.m_Line + "\n" + Tools.createPosPointer(this.m_Line, this.m_filePos.getCol()));
|
||||||
//Log.critical("detect error");
|
//Log.critical("detect error");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +196,7 @@ public class Document extends Element {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeType getType() {
|
public NodeType getType() {
|
||||||
return NodeType.document;
|
return NodeType.DOCUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -6,6 +11,8 @@ import java.util.ListIterator;
|
|||||||
|
|
||||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
@ -53,10 +60,6 @@ public class Element extends AttributeList {
|
|||||||
Log.error("Try to set an empty node");
|
Log.error("Try to set an empty node");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_node.getType() == NodeType.attribute) {
|
|
||||||
appendAttribute(_node.toAttribute());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||||
if (this.m_listSub.get(iii) == _node) {
|
if (this.m_listSub.get(iii) == _node) {
|
||||||
Log.error("Try to add a node that is already added before !!!");
|
Log.error("Try to add a node that is already added before !!!");
|
||||||
@ -117,7 +120,7 @@ public class Element extends AttributeList {
|
|||||||
*/
|
*/
|
||||||
public Node getNode(final int _id) throws ExmlNodeDoesNotExist {
|
public Node getNode(final int _id) throws ExmlNodeDoesNotExist {
|
||||||
if (_id < 0 || _id >= this.m_listSub.size()) {
|
if (_id < 0 || _id >= this.m_listSub.size()) {
|
||||||
throw new ExmlNodeDoesNotExist("Node does not exist: " + _id + "/" + this.m_listAttribute.size());
|
throw new ExmlNodeDoesNotExist("Node does not exist: " + _id + "/" + this.m_listSub.size());
|
||||||
}
|
}
|
||||||
return this.m_listSub.get(_id);
|
return this.m_listSub.get(_id);
|
||||||
}
|
}
|
||||||
@ -155,7 +158,7 @@ public class Element extends AttributeList {
|
|||||||
public String getText() {
|
public String getText() {
|
||||||
final StringBuilder res = new StringBuilder();
|
final StringBuilder res = new StringBuilder();
|
||||||
if (this.m_listSub.size() == 1) {
|
if (this.m_listSub.size() == 1) {
|
||||||
if (this.m_listSub.get(0).getType() == NodeType.text) {
|
if (this.m_listSub.get(0).getType() == NodeType.TEXT) {
|
||||||
res.append(this.m_listSub.get(0).getValue());
|
res.append(this.m_listSub.get(0).getValue());
|
||||||
} else {
|
} else {
|
||||||
this.m_listSub.get(0).iGenerate(res, 0);
|
this.m_listSub.get(0).iGenerate(res, 0);
|
||||||
@ -172,30 +175,31 @@ public class Element extends AttributeList {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeType getType() {
|
public NodeType getType() {
|
||||||
return NodeType.element;
|
return NodeType.ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the type of the element id.
|
* @brief get the type of the element id.
|
||||||
* @param[in] _id Id of the element.
|
* @param[in] _id Id of the element.
|
||||||
* @return the Current type of the element or typeUnknow.
|
* @return the Current type of the element or typeUnknow.
|
||||||
|
* @throws ExmlNodeDoesNotExist The Node does not exist
|
||||||
*/
|
*/
|
||||||
public NodeType getType(final int _id) {
|
public NodeType getType(final int _id) throws ExmlNodeDoesNotExist {
|
||||||
if (_id < 0 || _id >= this.m_listSub.size()) {
|
if (_id < 0 || _id >= this.m_listSub.size()) {
|
||||||
return NodeType.unknow;
|
throw new ExmlNodeDoesNotExist("Node does not exist: " + _id + "/" + this.m_listSub.size());
|
||||||
}
|
}
|
||||||
return this.m_listSub.get(_id).getType();
|
return this.m_listSub.get(_id).getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||||
addIndent(_data, _indent);
|
Tools.addIndent(_data, _indent);
|
||||||
_data.append("<");
|
_data.append("<");
|
||||||
_data.append(this.m_value);
|
_data.append(this.m_value);
|
||||||
super.iGenerate(_data, _indent);
|
super.iGenerate(_data, _indent);
|
||||||
|
|
||||||
if (this.m_listSub.size() > 0) {
|
if (this.m_listSub.size() > 0) {
|
||||||
if (this.m_listSub.size() == 1 && this.m_listSub.get(0) != null && this.m_listSub.get(0).getType() == NodeType.text && ((Text) this.m_listSub.get(0)).countLines() == 1) {
|
if (this.m_listSub.size() == 1 && this.m_listSub.get(0) != null && this.m_listSub.get(0).getType() == NodeType.TEXT && ((Text) this.m_listSub.get(0)).countLines() == 1) {
|
||||||
_data.append(">");
|
_data.append(">");
|
||||||
this.m_listSub.get(0).iGenerate(_data, 0);
|
this.m_listSub.get(0).iGenerate(_data, 0);
|
||||||
Log.verbose(" generate : '" + _data + "'");
|
Log.verbose(" generate : '" + _data + "'");
|
||||||
@ -206,7 +210,7 @@ public class Element extends AttributeList {
|
|||||||
this.m_listSub.get(iii).iGenerate(_data, _indent + 1);
|
this.m_listSub.get(iii).iGenerate(_data, _indent + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addIndent(_data, _indent);
|
Tools.addIndent(_data, _indent);
|
||||||
}
|
}
|
||||||
_data.append("</");
|
_data.append("</");
|
||||||
_data.append(this.m_value);
|
_data.append(this.m_value);
|
||||||
@ -225,7 +229,7 @@ public class Element extends AttributeList {
|
|||||||
// find a normal node ...
|
// find a normal node ...
|
||||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||||
_filePos.check(_data.charAt(iii));
|
_filePos.check(_data.charAt(iii));
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_data.charAt(iii) == '>') {
|
if (_data.charAt(iii) == '>') {
|
||||||
// we find the end ...
|
// we find the end ...
|
||||||
_pos.value = iii + 1;
|
_pos.value = iii + 1;
|
||||||
@ -246,7 +250,7 @@ public class Element extends AttributeList {
|
|||||||
_doc.createError(_data, _pos.value, _filePos, "Find / without > char ...");
|
_doc.createError(_data, _pos.value, _filePos, "Find / without > char ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (checkAvaillable(_data.charAt(iii), true) == true) {
|
if (Tools.checkAvaillable(_data.charAt(iii), true) == true) {
|
||||||
// we find an attibute == > create an element and parse it:
|
// we find an attibute == > create an element and parse it:
|
||||||
final Attribute attribute = new Attribute();
|
final Attribute attribute = new Attribute();
|
||||||
_pos.value = iii;
|
_pos.value = iii;
|
||||||
@ -257,7 +261,7 @@ public class Element extends AttributeList {
|
|||||||
this.m_listAttribute.add(attribute);
|
this.m_listAttribute.add(attribute);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isWhiteChar(_data.charAt(iii)) == false) {
|
if (Tools.isWhiteChar(_data.charAt(iii)) == false) {
|
||||||
_doc.createError(_data, iii, _filePos, "Find an unknow element : '" + _data.charAt(iii) + "'");
|
_doc.createError(_data, iii, _filePos, "Find an unknow element : '" + _data.charAt(iii) + "'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -313,10 +317,10 @@ public class Element extends AttributeList {
|
|||||||
//EXML_PARSE_ELEMENT(" start subParse ... " << _pos << " " << _filePos);
|
//EXML_PARSE_ELEMENT(" start subParse ... " << _pos << " " << _filePos);
|
||||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||||
_filePos.check(_data.charAt(iii));
|
_filePos.check(_data.charAt(iii));
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
final FilePos tmpPos = new FilePos();
|
final FilePos tmpPos = new FilePos();
|
||||||
if (_data.charAt(iii) == '<') {
|
if (_data.charAt(iii) == '<') {
|
||||||
final int white = countWhiteChar(_data, iii + 1, tmpPos);
|
final int white = Tools.countWhiteChar(_data, iii + 1, tmpPos);
|
||||||
if (iii + white + 1 >= _data.length()) {
|
if (iii + white + 1 >= _data.length()) {
|
||||||
_filePos.add(tmpPos);
|
_filePos.add(tmpPos);
|
||||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<' char == > invalide XML");
|
_doc.createError(_data, _pos.value, _filePos, "End file with '<' char == > invalide XML");
|
||||||
@ -333,7 +337,7 @@ public class Element extends AttributeList {
|
|||||||
if (_data.charAt(iii + white + 1) == '?') {
|
if (_data.charAt(iii + white + 1) == '?') {
|
||||||
tmpPos.increment();
|
tmpPos.increment();
|
||||||
// TODO : white space ...
|
// TODO : white space ...
|
||||||
if (checkAvaillable(_data.charAt(iii + white + 2), true) == false) {
|
if (Tools.checkAvaillable(_data.charAt(iii + white + 2), true) == false) {
|
||||||
_doc.createError(_data, _pos.value, _filePos, "Find unavaillable name in the Declaration node...");
|
_doc.createError(_data, _pos.value, _filePos, "Find unavaillable name in the Declaration node...");
|
||||||
_pos.value = iii + white + 1;
|
_pos.value = iii + white + 1;
|
||||||
return false;
|
return false;
|
||||||
@ -342,7 +346,7 @@ public class Element extends AttributeList {
|
|||||||
int endPosName = iii + white + 1;
|
int endPosName = iii + white + 1;
|
||||||
// generate element name ...
|
// generate element name ...
|
||||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
if (Tools.checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||||
// we find the end ...
|
// we find the end ...
|
||||||
endPosName = jjj;
|
endPosName = jjj;
|
||||||
} else {
|
} else {
|
||||||
@ -426,7 +430,7 @@ public class Element extends AttributeList {
|
|||||||
int endPosName = iii + white + 1;
|
int endPosName = iii + white + 1;
|
||||||
// generate element name ...
|
// generate element name ...
|
||||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
if (Tools.checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||||
// we find the end ...
|
// we find the end ...
|
||||||
endPosName = jjj;
|
endPosName = jjj;
|
||||||
} else {
|
} else {
|
||||||
@ -442,7 +446,7 @@ public class Element extends AttributeList {
|
|||||||
// find end of node :
|
// find end of node :
|
||||||
// find > element ...
|
// find > element ...
|
||||||
for (int jjj = endPosName + 1; jjj < _data.length(); jjj++) {
|
for (int jjj = endPosName + 1; jjj < _data.length(); jjj++) {
|
||||||
drawElementParsed(_data.charAt(jjj), _filePos);
|
Tools.drawElementParsed(_data.charAt(jjj), _filePos);
|
||||||
if (tmpPos.check(_data.charAt(jjj)) == true) {
|
if (tmpPos.check(_data.charAt(jjj)) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -467,13 +471,13 @@ public class Element extends AttributeList {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkAvaillable(_data.charAt(iii + white + 1), true) == true) {
|
if (Tools.checkAvaillable(_data.charAt(iii + white + 1), true) == true) {
|
||||||
tmpPos.increment();
|
tmpPos.increment();
|
||||||
Log.debug("Generate node name : '" + _data.charAt(iii + 1) + "'");
|
Log.debug("Generate node name : '" + _data.charAt(iii + 1) + "'");
|
||||||
int endPosName = iii + white + 1;
|
int endPosName = iii + white + 1;
|
||||||
// generate element name ...
|
// generate element name ...
|
||||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
if (Tools.checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||||
// we find the end ...
|
// we find the end ...
|
||||||
endPosName = jjj;
|
endPosName = jjj;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
|
@ -1,33 +1,25 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Basic main object of all xml elements.
|
* @brief Basic main object of all xml elements.
|
||||||
*/
|
*/
|
||||||
public abstract class Node {
|
public abstract class Node {
|
||||||
|
|
||||||
protected class PositionParsing {
|
protected FilePos m_pos; //!< position in the read file (null if the file is not parsed)
|
||||||
public int value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static boolean isWhiteChar(final Character _val) {
|
|
||||||
if (_val == ' ' || _val == '\t' || _val == '\n' || _val == '\r') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected FilePos m_pos; //!< position in the readed file == > not correct when the file is generated;
|
|
||||||
|
|
||||||
protected String m_value; //!< value of the node (for element this is the name, for text it is the inside text ...);
|
protected String m_value; //!< value of the node (for element this is the name, for text it is the inside text ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
public Node() {
|
public Node() {
|
||||||
this.m_pos = new FilePos(0, 0);
|
this.m_pos = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,49 +27,16 @@ public abstract class Node {
|
|||||||
* @param[in] _value value of the node
|
* @param[in] _value value of the node
|
||||||
*/
|
*/
|
||||||
public Node(final String _value) {
|
public Node(final String _value) {
|
||||||
this.m_pos = new FilePos(0, 0);
|
this.m_pos = null;
|
||||||
this.m_value = _value;
|
this.m_value = _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief add indentation of the string input.
|
|
||||||
* @param[in,out] _data String where the indentation is done.
|
|
||||||
* @param[in] _indent Number of tab to add at the string.
|
|
||||||
*/
|
|
||||||
protected void addIndent(final StringBuilder _data, final int _indent) {
|
|
||||||
for (int iii = 0; iii < _indent; iii++) {
|
|
||||||
_data.append("\t");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief check if an element or attribute is availlable (not : !"#$%&'()*+,/;<=>?@[\]^`{|}~ \\n\\t\\r and for first char : not -.0123456789).
|
|
||||||
* @param[in] _val Value to check the conformity.
|
|
||||||
* @param[in] _firstChar True if the element check is the first char.
|
|
||||||
* @return true The value can be a part of attribute name
|
|
||||||
* @return false The value can NOT be a part of attribute name
|
|
||||||
*/
|
|
||||||
protected boolean checkAvaillable(final Character _val, final boolean _firstChar) {
|
|
||||||
if (_val == '!' || _val == '"' || _val == '#' || _val == '$' || _val == '%' || _val == '&' || _val == '\'' // '
|
|
||||||
|| _val == '(' || _val == ')' || _val == '*' || _val == '+' || _val == ',' || _val == '/' || _val == ';' || _val == '<' || _val == '=' || _val == '>' || _val == '?' || _val == '@'
|
|
||||||
|| _val == '[' || _val == '\\' || _val == ']' || _val == '^' || _val == '`' || _val == '{' || _val == '|' || _val == '}' || _val == '~' || _val == ' ' || _val == '\n' || _val == '\t'
|
|
||||||
|| _val == '\r') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (_firstChar == true) {
|
|
||||||
if (_val == '-' || _val == '.' || (_val >= '0' && _val <= '9')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief clear the Node
|
* @brief clear the Node
|
||||||
*/
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.m_value = "";
|
this.m_value = "";
|
||||||
this.m_pos.clear();
|
this.m_pos = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,43 +44,6 @@ public abstract class Node {
|
|||||||
throw new CloneNotSupportedException("Can not clone an abstract class ...");
|
throw new CloneNotSupportedException("Can not clone an abstract class ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief count the number of white char in the string from the specify position (stop at the first element that is not a white char)
|
|
||||||
* @param[in] _data Data to parse.
|
|
||||||
* @param[in] _pos Start position in the string.
|
|
||||||
* @param[out] _filePos new poistion of te file to add.
|
|
||||||
* @return number of white element.
|
|
||||||
*/
|
|
||||||
protected int countWhiteChar(final String _data, final int _pos, final FilePos _filePos) {
|
|
||||||
_filePos.clear();
|
|
||||||
int white = 0;
|
|
||||||
for (int iii = _pos; iii < _data.length(); iii++) {
|
|
||||||
_filePos.check(_data.charAt(iii));
|
|
||||||
if (isWhiteChar(_data.charAt(iii)) == true) {
|
|
||||||
white++;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_filePos.decrement();
|
|
||||||
return white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display the cuurent element that is curently parse.
|
|
||||||
* @param[in] _val Char that is parsed.
|
|
||||||
* @param[in] _filePos Position of the char in the file.
|
|
||||||
*/
|
|
||||||
protected void drawElementParsed(final Character _val, final FilePos _filePos) {
|
|
||||||
if (_val == '\n') {
|
|
||||||
Log.debug(_filePos + " parse '\\n'");
|
|
||||||
} else if (_val == '\t') {
|
|
||||||
Log.debug(_filePos + " parse '\\t'");
|
|
||||||
} else {
|
|
||||||
Log.debug(_filePos + " parse '" + _val + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current position where the element is in the file
|
* @brief get the current position where the element is in the file
|
||||||
* @return The file position reference
|
* @return The file position reference
|
||||||
@ -134,9 +56,7 @@ public abstract class Node {
|
|||||||
* @brief get the node type.
|
* @brief get the node type.
|
||||||
* @return the type of the Node.
|
* @return the type of the Node.
|
||||||
*/
|
*/
|
||||||
NodeType getType() {
|
public abstract NodeType getType();
|
||||||
return NodeType.node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current element Value.
|
* @brief get the current element Value.
|
||||||
@ -152,9 +72,7 @@ public abstract class Node {
|
|||||||
* @param[in] _indent current indentation of the file
|
* @param[in] _indent current indentation of the file
|
||||||
* @return false if an error occured.
|
* @return false if an error occured.
|
||||||
*/
|
*/
|
||||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
protected abstract boolean iGenerate(final StringBuilder _data, final int _indent);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief parse the Current node [pure VIRUAL]
|
* @brief parse the Current node [pure VIRUAL]
|
||||||
@ -168,50 +86,42 @@ public abstract class Node {
|
|||||||
protected abstract boolean iParse(String _data, PositionParsing _pos, boolean _caseSensitive, FilePos _filePos, Document _doc);
|
protected abstract boolean iParse(String _data, PositionParsing _pos, boolean _caseSensitive, FilePos _filePos, Document _doc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a exml::Attribute
|
* @brief check if the node is a Comment
|
||||||
* @return true if the node is a exml::Attribute
|
* @return true if the node is a Comment
|
||||||
*/
|
*/
|
||||||
public boolean isAttribute() {
|
public final boolean isComment() {
|
||||||
return this instanceof Attribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief check if the node is a exml::Comment
|
|
||||||
* @return true if the node is a exml::Comment
|
|
||||||
*/
|
|
||||||
public boolean isComment() {
|
|
||||||
return this instanceof Comment;
|
return this instanceof Comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a exml::Declaration
|
* @brief check if the node is a Declaration
|
||||||
* @return true if the node is a exml::Declaration
|
* @return true if the node is a Declaration
|
||||||
*/
|
*/
|
||||||
public boolean isDeclaration() {
|
public final boolean isDeclaration() {
|
||||||
return this instanceof Declaration;
|
return this instanceof Declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a exml::Document
|
* @brief check if the node is a Document
|
||||||
* @return true if the node is a exml::Document
|
* @return true if the node is a Document
|
||||||
*/
|
*/
|
||||||
public boolean isDocument() {
|
public final boolean isDocument() {
|
||||||
return this instanceof Document;
|
return this instanceof Document;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a exml::Element
|
* @brief check if the node is a Element
|
||||||
* @return true if the node is a exml::Element
|
* @return true if the node is a Element
|
||||||
*/
|
*/
|
||||||
public boolean isElement() {
|
public final boolean isElement() {
|
||||||
return this instanceof Element;
|
return this instanceof Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a exml::Text
|
* @brief check if the node is a Text
|
||||||
* @return true if the node is a exml::Text
|
* @return true if the node is a Text
|
||||||
*/
|
*/
|
||||||
public boolean isText() {
|
public final boolean isText() {
|
||||||
return this instanceof Text;
|
return this instanceof Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,23 +130,15 @@ public abstract class Node {
|
|||||||
* @param[in] _value New value of the node.
|
* @param[in] _value New value of the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setValue(final String _value) {
|
public final void setValue(final String _value) {
|
||||||
this.m_value = _value;
|
this.m_value = _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Cast the element in a Attribute if it is possible.
|
|
||||||
* @return pointer on the class or null.
|
|
||||||
*/
|
|
||||||
public Attribute toAttribute() {
|
|
||||||
return (Attribute) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Comment if it is possible.
|
* @brief Cast the element in a Comment if it is possible.
|
||||||
* @return pointer on the class or null.
|
* @return pointer on the class or null.
|
||||||
*/
|
*/
|
||||||
public Comment toComment() {
|
public final Comment toComment() {
|
||||||
return (Comment) this;
|
return (Comment) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +146,7 @@ public abstract class Node {
|
|||||||
* @brief Cast the element in a Declaration if it is possible.
|
* @brief Cast the element in a Declaration if it is possible.
|
||||||
* @return pointer on the class or null.
|
* @return pointer on the class or null.
|
||||||
*/
|
*/
|
||||||
public Declaration toDeclaration() {
|
public final Declaration toDeclaration() {
|
||||||
return (Declaration) this;
|
return (Declaration) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +154,7 @@ public abstract class Node {
|
|||||||
* @brief Cast the element in a Document if it is possible.
|
* @brief Cast the element in a Document if it is possible.
|
||||||
* @return pointer on the class or null.
|
* @return pointer on the class or null.
|
||||||
*/
|
*/
|
||||||
public Document toDocument() {
|
public final Document toDocument() {
|
||||||
return (Document) this;
|
return (Document) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +162,7 @@ public abstract class Node {
|
|||||||
* @brief Cast the element in a Element if it is possible.
|
* @brief Cast the element in a Element if it is possible.
|
||||||
* @return pointer on the class or null.
|
* @return pointer on the class or null.
|
||||||
*/
|
*/
|
||||||
public Element toElement() {
|
public final Element toElement() {
|
||||||
return (Element) this;
|
return (Element) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +170,7 @@ public abstract class Node {
|
|||||||
* @brief Cast the element in a Text if it is possible.
|
* @brief Cast the element in a Text if it is possible.
|
||||||
* @return pointer on the class or null.
|
* @return pointer on the class or null.
|
||||||
*/
|
*/
|
||||||
public Text toText() {
|
public final Text toText() {
|
||||||
return (Text) this;
|
return (Text) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
package org.atriasoft.exml;
|
|
||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Type of the XML elements.
|
* @brief Type of the XML elements.
|
||||||
*/
|
*/
|
||||||
public enum NodeType {
|
public enum NodeType {
|
||||||
unknow, //!< might be an error ...
|
DOCUMENT, //!< all the file main access
|
||||||
node, //!< might be an error ...
|
DECLARATION, //!< <?xml ... ?>
|
||||||
document, //!< all the file main access
|
ELEMENT, //!< the <XXX> ... </XXX>
|
||||||
declaration, //!< <?xml ... ?>
|
COMMENT, //!< comment node : <!-- -->
|
||||||
attribute, //!< the <Element ATTRIBUTE="ATTRIBUTE_VALUE" />
|
TEXT, //!< <XXX> InsideText </XXX>
|
||||||
element, //!< the <XXX> ... </XXX>
|
|
||||||
comment, //!< comment node : <!-- -->
|
|
||||||
text, //!< <XXX> InsideText </XXX>
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package org.atriasoft.exml;
|
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Text node interface (internal data between two Marker: <XXX> ALL here </XXX>
|
* @brief Text node interface (internal data between two Marker: <XXX> ALL here </XXX>
|
||||||
@ -68,8 +70,8 @@ public class Text extends Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
NodeType getType() {
|
public NodeType getType() {
|
||||||
return NodeType.text;
|
return NodeType.TEXT;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,10 +83,10 @@ public class Text extends Node {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||||
Log.verbose("start parse : 'text'");
|
Log.verbose("start parse : 'text'");
|
||||||
this.m_pos = _filePos;
|
this.m_pos = _filePos.clone();
|
||||||
// search end of the comment :
|
// search end of the comment :
|
||||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -92,7 +94,7 @@ public class Text extends Node {
|
|||||||
// search whitespace :
|
// search whitespace :
|
||||||
int newEnd = iii;
|
int newEnd = iii;
|
||||||
for (int jjj = iii - 1; jjj > _pos.value; --jjj) {
|
for (int jjj = iii - 1; jjj > _pos.value; --jjj) {
|
||||||
if (isWhiteChar(_data.charAt(jjj)) == true) {
|
if (Tools.isWhiteChar(_data.charAt(jjj)) == true) {
|
||||||
newEnd = jjj;
|
newEnd = jjj;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml;
|
package org.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.internal.Log;
|
import org.atriasoft.exml.internal.Log;
|
||||||
|
import org.atriasoft.exml.internal.PositionParsing;
|
||||||
|
import org.atriasoft.exml.internal.Tools;
|
||||||
|
|
||||||
public class TextCDATA extends Text {
|
public class TextCDATA extends Text {
|
||||||
public TextCDATA() {
|
public TextCDATA() {
|
||||||
@ -22,10 +29,10 @@ public class TextCDATA extends Text {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||||
Log.verbose("start parse : 'text::CDATA'");
|
Log.verbose("start parse : 'text::CDATA'");
|
||||||
this.m_pos = _filePos;
|
this.m_pos = _filePos.clone();
|
||||||
// search end of the comment :
|
// search end of the comment :
|
||||||
for (int iii = _pos.value; iii + 2 < _data.length(); iii++) {
|
for (int iii = _pos.value; iii + 2 < _data.length(); iii++) {
|
||||||
drawElementParsed(_data.charAt(iii), _filePos);
|
Tools.drawElementParsed(_data.charAt(iii), _filePos);
|
||||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml.exception;
|
package org.atriasoft.exml.exception;
|
||||||
|
|
||||||
public class ExmlAttributeDoesNotExist extends ExmlException {
|
public class ExmlAttributeDoesNotExist extends ExmlException {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml.exception;
|
package org.atriasoft.exml.exception;
|
||||||
|
|
||||||
public class ExmlException extends Exception {
|
public class ExmlException extends Exception {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml.exception;
|
package org.atriasoft.exml.exception;
|
||||||
|
|
||||||
public class ExmlNodeDoesNotExist extends ExmlException {
|
public class ExmlNodeDoesNotExist extends ExmlException {
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package org.atriasoft.exml.internal;
|
package org.atriasoft.exml.internal;
|
||||||
|
|
||||||
import io.scenarium.logger.LogLevel;
|
import io.scenarium.logger.LogLevel;
|
||||||
|
6
src/org/atriasoft/exml/internal/PositionParsing.java
Normal file
6
src/org/atriasoft/exml/internal/PositionParsing.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package org.atriasoft.exml.internal;
|
||||||
|
|
||||||
|
public class PositionParsing {
|
||||||
|
public int value = 0;
|
||||||
|
|
||||||
|
}
|
101
src/org/atriasoft/exml/internal/Tools.java
Normal file
101
src/org/atriasoft/exml/internal/Tools.java
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
package org.atriasoft.exml.internal;
|
||||||
|
|
||||||
|
import org.atriasoft.exml.FilePos;
|
||||||
|
|
||||||
|
public class Tools {
|
||||||
|
/**
|
||||||
|
* @brief add indentation of the string input.
|
||||||
|
* @param[in,out] _data String where the indentation is done.
|
||||||
|
* @param[in] _indent Number of tab to add at the string.
|
||||||
|
*/
|
||||||
|
public static void addIndent(final StringBuilder _data, final int _indent) {
|
||||||
|
for (int iii = 0; iii < _indent; iii++) {
|
||||||
|
_data.append("\t");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief check if an element or attribute is availlable (not : !"#$%&'()*+,/;<=>?@[\]^`{|}~ \\n\\t\\r and for first char : not -.0123456789).
|
||||||
|
* @param[in] _val Value to check the conformity.
|
||||||
|
* @param[in] _firstChar True if the element check is the first char.
|
||||||
|
* @return true The value can be a part of attribute name
|
||||||
|
* @return false The value can NOT be a part of attribute name
|
||||||
|
*/
|
||||||
|
public static boolean checkAvaillable(final Character _val, final boolean _firstChar) {
|
||||||
|
if (_val == '!' || _val == '"' || _val == '#' || _val == '$' || _val == '%' || _val == '&' || _val == '\'' // '
|
||||||
|
|| _val == '(' || _val == ')' || _val == '*' || _val == '+' || _val == ',' || _val == '/' || _val == ';' || _val == '<' || _val == '=' || _val == '>' || _val == '?' || _val == '@'
|
||||||
|
|| _val == '[' || _val == '\\' || _val == ']' || _val == '^' || _val == '`' || _val == '{' || _val == '|' || _val == '}' || _val == '~' || _val == ' ' || _val == '\n' || _val == '\t'
|
||||||
|
|| _val == '\r') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_firstChar == true) {
|
||||||
|
if (_val == '-' || _val == '.' || (_val >= '0' && _val <= '9')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief count the number of white char in the string from the specify position (stop at the first element that is not a white char)
|
||||||
|
* @param[in] _data Data to parse.
|
||||||
|
* @param[in] _pos Start position in the string.
|
||||||
|
* @param[out] _filePos new poistion of te file to add.
|
||||||
|
* @return number of white element.
|
||||||
|
*/
|
||||||
|
public static int countWhiteChar(final String _data, final int _pos, final FilePos _filePos) {
|
||||||
|
_filePos.clear();
|
||||||
|
int white = 0;
|
||||||
|
for (int iii = _pos; iii < _data.length(); iii++) {
|
||||||
|
_filePos.check(_data.charAt(iii));
|
||||||
|
if (Tools.isWhiteChar(_data.charAt(iii)) == true) {
|
||||||
|
white++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_filePos.decrement();
|
||||||
|
return white;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createPosPointer(final String _line, final int _pos) {
|
||||||
|
String out = "";
|
||||||
|
int iii;
|
||||||
|
for (iii = 0; iii < _pos && iii < _line.length(); iii++) {
|
||||||
|
if (_line.charAt(iii) == '\t') {
|
||||||
|
out += "\t";
|
||||||
|
} else {
|
||||||
|
out += " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (; iii < _pos; iii++) {
|
||||||
|
out += " ";
|
||||||
|
}
|
||||||
|
out += "^";
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Display the cuurent element that is curently parse.
|
||||||
|
* @param[in] _val Char that is parsed.
|
||||||
|
* @param[in] _filePos Position of the char in the file.
|
||||||
|
*/
|
||||||
|
public static void drawElementParsed(final Character _val, final FilePos _filePos) {
|
||||||
|
if (_val == '\n') {
|
||||||
|
Log.debug(_filePos + " parse '\\n'");
|
||||||
|
} else if (_val == '\t') {
|
||||||
|
Log.debug(_filePos + " parse '\\t'");
|
||||||
|
} else {
|
||||||
|
Log.debug(_filePos + " parse '" + _val + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWhiteChar(final Character _val) {
|
||||||
|
if (_val == ' ' || _val == '\t' || _val == '\n' || _val == '\r') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tools() {}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
/** @file
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
|
||||||
* @license MPL v2.0 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class ExmlTestAll {
|
public class ExmlTestAll {
|
||||||
|
@ -8,7 +8,6 @@ package test.atriasoft.exml;
|
|||||||
import org.atriasoft.exml.Attribute;
|
import org.atriasoft.exml.Attribute;
|
||||||
import org.atriasoft.exml.Document;
|
import org.atriasoft.exml.Document;
|
||||||
import org.atriasoft.exml.Element;
|
import org.atriasoft.exml.Element;
|
||||||
import org.atriasoft.exml.NodeType;
|
|
||||||
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
||||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
@ -34,13 +33,6 @@ public class ExmlTestAttribute {
|
|||||||
myAttribute.clear();
|
myAttribute.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void create() {
|
|
||||||
|
|
||||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
|
||||||
Assertions.assertEquals(myAttribute.getType(), NodeType.attribute);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createAssignement() {
|
public void createAssignement() {
|
||||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
|
||||||
import org.atriasoft.exml.Document;
|
import org.atriasoft.exml.Document;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
@ -21,7 +21,7 @@ public class ExmlTestComment {
|
|||||||
@Test
|
@Test
|
||||||
public void create() {
|
public void create() {
|
||||||
final Comment myComment = new Comment("my Comment");
|
final Comment myComment = new Comment("my Comment");
|
||||||
Assertions.assertEquals(myComment.getType(), NodeType.comment);
|
Assertions.assertEquals(myComment.getType(), NodeType.COMMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
@ -21,7 +21,7 @@ public class ExmlTestDeclarationXML {
|
|||||||
@Test
|
@Test
|
||||||
public void create() {
|
public void create() {
|
||||||
final DeclarationXML myDeclarationXML = new DeclarationXML("1.0", "UTF-8", true);
|
final DeclarationXML myDeclarationXML = new DeclarationXML("1.0", "UTF-8", true);
|
||||||
Assertions.assertEquals(myDeclarationXML.getType(), NodeType.declaration);
|
Assertions.assertEquals(myDeclarationXML.getType(), NodeType.DECLARATION);
|
||||||
try {
|
try {
|
||||||
Assertions.assertEquals(myDeclarationXML.getAttribute("version"), "1.0");
|
Assertions.assertEquals(myDeclarationXML.getAttribute("version"), "1.0");
|
||||||
Assertions.assertEquals(myDeclarationXML.getAttribute("encoding"), "UTF-8");
|
Assertions.assertEquals(myDeclarationXML.getAttribute("encoding"), "UTF-8");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
@ -53,7 +53,7 @@ public class ExmlTestElement {
|
|||||||
@Test
|
@Test
|
||||||
public void create() {
|
public void create() {
|
||||||
final Element myElement = new Element("NodeName");
|
final Element myElement = new Element("NodeName");
|
||||||
Assertions.assertEquals(myElement.getType(), NodeType.element);
|
Assertions.assertEquals(myElement.getType(), NodeType.ELEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -109,7 +109,7 @@ public class ExmlTestElement {
|
|||||||
@Test
|
@Test
|
||||||
public void getTypeId() {
|
public void getTypeId() {
|
||||||
final Element myElement = new Element("NodeName");
|
final Element myElement = new Element("NodeName");
|
||||||
Assertions.assertEquals(NodeType.unknow, myElement.getType(1));
|
Assertions.assertEquals(NodeType.UNKNOWN, myElement.getType(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
* @license MPL v2.0 (see license file)
|
* @license MPL v2.0 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/** @file
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||||
|
* @license MPL v2.0 (see license file)
|
||||||
|
*/
|
||||||
package test.atriasoft.exml;
|
package test.atriasoft.exml;
|
||||||
|
|
||||||
import io.scenarium.logger.LogLevel;
|
import io.scenarium.logger.LogLevel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user