logo back up home forward   further reading more topics »

XES - Programmers Guide - nodeConstant

for information about XES schema see these pages.

Constant

This node is used to hold a single constant value (known as a 'literal'). A nodeConstant holds one of the following types of literal: 'IntegerLiteral', 'FloatingPointLiteral', 'BooleanLiteral', 'CharacterLiteral', 'StringLiteral' or 'NullLiteral'

An integer literal may be expressed in decimal (base 10), hexadecimal (base 16), or octal (base 8):

A floating-point literal consists of two intergers, a mantissa part and an exponent. This may be represented by a number containing a decimal point '.' or an exponent 'e' or both. Both the mantissa and the exponent may have a negative sign.

A boolean literal may have the values 'true' or 'false'.

A character literal contains 'SingleCharacter' or 'EscapeSequence'

Attributes used

Only one of the following attributes may be used: "constantType","intConst","stringValue","floatValue","doubleValue","booleanValue".

Child Elements

The only child elements allowed are comments.

Schema entry

Holds a constant string, integer, floating point or boolean value

	<xs:complexType name="constantType">
<xs:attribute name="intConst" type="xs:int"/>
<xs:attribute name="stringValue" type="xs:string"/>
<xs:attribute name="floatValue" type="xs:float"/>
<xs:attribute name="doubleValue" type="xs:double"/>
<xs:attribute name="booleanValue" type="xs:boolean"/>
</xs:complexType>

Examples of usage

usage java example XES example
integer constant 0; <constant intConst="0"/>
negative integer constant i = -1; <assign operator="=">
<variable name="i"/>
<constant intConst="1"/>
</assign>
long integer 3L; <constant stringConst="3L"/>
floating point constant (default is double) 0.1; <constant doubleConst="0.1"/>
floating point constant, explicitly declaired as float 0.2f; <constant doubleConst="0.2"/>
floating point constant, explicitly declaired as double 0.3d; <constant doubleConst="0.3"/>
floating point with exponent 5e-6; <constant doubleConst="5.0E-6"/>
boolean constant true; <constant boolConst="true"/>
character constant 'c'; <constant stringConst="'c'"/>
unicode character char c = '\uFFFF'; <variable name="c" type="char">
<assign operator="=">
<constant stringConst="'?'"/>
</assign>
</variable>
octal 0777; <constant intConst="777">
hexadecimal 0x7fff; <constant stringConst="0x7fff">
string constant "string"; <constant stringConst="&quot;string&quot;"/>
null reference null; <constant stringConst="null"/>
array initialiser list int v[]={1,2,3,4}; <variable isArray="true" name="v" type="int">
<assign operator="=">
<array>
<constant intConst="1"/>
<constant intConst="2"/>
<constant intConst="3"/>
<constant intConst="4"/>
</array>
</assign>
</variable>
     
     
     
     
     
     
     
     
     
     
     
     
     
     

metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Processing XML with Java: A Guide to SAX, DOM, JDOM, JAXP, and TrAX

Other Java books

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover JBuilder - There is also a free version of Jbuilder at borland website . However its licence conditions are quite restrictive so you may prefer another java IDE.

Can this page be improved?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

progam

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

for xml encoding: http://sourceforge.net/projects/xes/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved - privacy policy.