Listing 1
// module XMLValue
valuetype Node
{
// NodeType
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2;
const unsigned short TEXT_NODE = 3;
const unsigned short CDATA_SECTION_NODE =
4;
const unsigned short ENTITY_REFERENCE_NODE
= 5;
const unsigned short ENTITY_NODE = 6;
const unsigned short PROCESSING_INSTRUCTION_NODE
= 7;
const unsigned short COMMENT_NODE = 8;
const unsigned short DOCUMENT_NODE = 9;
const unsigned short DOCUMENT_TYPE_NODE =
10;
const unsigned short DOCUMENT_FRAGMENT_NODE
= 11;
const unsigned short NOTATION_NODE = 12;
private DOMString nodeName;
private DOMString nodeValue;
private unsigned short nodeType;
private Node parentNode;
private NodeList childNodes;
private Node firstChild;
private Node lastChild;
private Node previousSibling;
private Node nextSibling;
private NamedNodeMap publics;
// Modified in DOM Level 2:
private Document ownerDocument;
Node insertBefore(in Node newChild, in Node
refChild)
raises(DOMException);
Node replaceChild(in Node newChild, in Node
refChild)
raises(DOMException);
Node removeChild(in Node oldChild) raises(DOMException);
Node appendChild(in Node newChild) raises(DOMException);
boolean hasChildNodes();
Node cloneNode(in boolean deep);
// Introduced in DOM Level 2
// Modified for XML over CORBA from 'supports'
to 'DOMsupports'
boolean DOMsupports(in DOMString feature,
in DOMString version );
// Introduced in DOM Level 2
private DOMString namespaceURI;
private DOMString prefix;
private DOMString localName;
// Introduced for XML Over CORBA
sequence<Node> children;
};
Listing 2
<?xml version="1.0"?>
<Portfolio>
<Stock name=¹TOI¹ url=¹http://www.toi.com¹>
<Holding>
<Quantity>1000</Quantity>
<Price>45</Price>
<CurrentPrice>43</CurrentPrice>
<Value>43000</Value>
<Performance>-2000</Performance>
<Holding>
</Stock>
<Stock name=¹PPP¹ url=¹http://www.ppp.com¹>
<Holding>
<Quantity>3000</Quantity>
<Price>25</Price>
<CurrentPrice>30</CurrentPrice>
<Value>90000</Value>
<Performance>+15000</Performance>
<Holding>
</Stock>
<Portfolio>
struct Quantity
{
float _Value;
};
struct Price
{
float _Value;
};
struct CurrentPrice
{
float _Value;
};
struct Value
{
float _Value;
};
struct Performance
{
float _Value;
};
struct Holding
{
Quantity quantity;
Price price;
CurrentPrice currentPrice;
Performance performance;
};
struct Stock
{
string name;
string url;
sequence<Holding> holdings;
};
struct Portfolio
{
sequence<Stock> stocks;
};