Newer
Older
Unknown (abagchi)
committed
<?xml version="1.0" standalone="no"?>
<!--
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
Unknown (abagchi)
committed
<s1 title="Sample: MemParse">
Unknown (abagchi)
committed
<s2 title="MemParse">
<p>MemParse uses the Validating SAX Parser to parse a memory buffer containing
XML statements, and reports the number of elements and attributes found.</p>
<s3 title="Running MemParse">
<p>This program uses the SAX Parser to parse a memory buffer
containing XML statements, and reports the number of elements and attributes
found. </p>
<p>The following parameters may be set from the command line </p>
<source>
Usage:
MemParse [options]
This program uses the SAX Parser to parse a memory buffer
containing XML statements, and reports the number of
elements and attributes found.
Options:
-v=xxx Validation scheme [always | never | auto*].
-n Enable namespace processing. Defaults to off.
-s Enable schema processing. Defaults to off.
-f Enable full schema constraint checking. Defaults to off.
-? Show this help.
* = Default if not provided explicitly.
</source>
<p><em>-v=always</em> will force validation<br/>
<em>-v=never</em> will not use any validation<br/>
<em>-v=auto</em> will validate if a DOCTYPE declaration or a schema declaration is present in the XML document</p>
<p>Here is a sample output from MemParse</p>
Unknown (abagchi)
committed
<p>The output is the following:</p>
<source>Finished parsing the memory buffer containing the following XML statements:
<?xml version='1.0' encoding='ascii'?>
<!DOCTYPE company [
<!ELEMENT company (product,category,developedAt)>
<!ELEMENT product (#PCDATA)>
<!ELEMENT category (#PCDATA)>
<!ATTLIST category idea CDATA #IMPLIED>
<!ELEMENT developedAt (#PCDATA)>
]>
<company>
<product>XML4C</product>
<category idea='great'>XML Parsing Tools</category>
<developedAt>
IBM Center for Java Technology, Silicon Valley, Cupertino, CA
</developedAt>
</company>
Parsing took 10 ms (4 elements, 1 attributes, 16 spaces, 95 characters).</source>
<p>Running MemParse with the validating parser gives a different result because
ignorable white-space is counted separately from regular characters.</p>
<source>
MemParse -v=never</source>
Unknown (abagchi)
committed
<p>The output is the following:</p>
<source>Finished parsing the memory buffer containing the following XML statements:
<?xml version='1.0' encoding='ascii'?>
<!DOCTYPE company [
<!ELEMENT company (product,category,developedAt)>
<!ELEMENT product (#PCDATA)>
<!ELEMENT category (#PCDATA)>
<!ATTLIST category idea CDATA #IMPLIED>
<!ELEMENT developedAt (#PCDATA)>
]>
<company>
<product>XML4C</product>
Unknown (abagchi)
committed
<category idea='great'>XML Parsing Tools</category>
<developedAt>
IBM Center for Java Technology, Silicon Valley, Cupertino, CA
</developedAt>
</company>
Parsing took 10 ms (4 elements, 1 attributes, 0 spaces, 111 characters).</source>
<p>Note that the sum of spaces and characters in both versions is the same.</p>
<note>The time reported by the system may be different, depending on your
processor type.</note>
Unknown (abagchi)
committed
</s3>
</s2>
</s1>