MAP | SASAX Documents > What SASAX is [ <| 1| 2| 3| > ] |
This document explains what SASAX is.
SASAX is designed for parsing XML document representing structured data ("simple content"/"complex content" model of XML), but not for parsing XML document representing markup-ed document ("mixed content" model of XML), even though it may be also good for the later purpose unexpectedly.
In use of SASAX, (expected) structure of document to parse is represented as structure of Java object, and examined by them.
For example, you can parse(and examine) XML document "<int>123456</int>" by "element" shown in 'parsing "int" element'.
// code to parse XML document shown below. // <int> // 123456 // </int> IntElement element = new IntElement(null, "", "int");
And example for more complex XML document is shown in 'parsing "composite" element'.
// code to parse XML document shown below. // <composite> // <int>123456</int> // <string>string value</string> // </composite> CompositeElement element = new CompositeElement(null, "", "composite"); IntElement intValue = new IntElement(element, "", "int"); element.addMustItem(intValue); StringElement stringValue = new StringElement(element, "", "string"); element.addMustItem(stringValue);
You may notice that first argument for constructor is "parent" element (by the way,Second one is namespace URI, and third one is local name of element).
In the former example, the element named as "int" is root element of XML document and has no higher one, so the object refered by "element" variable is constructed with "null" as parent. In the later example, the element named as "composite" is constructed "null" parent because of same reason, but elements named as "int" or "string" are constructed with it as parent.
MAP | SASAX Documents > What SASAX is [ <| 1| 2| 3| > ] |