File: memparse.xml

package info (click to toggle)
xerces-c 3.3.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 19,944 kB
  • sloc: cpp: 167,332; xml: 23,639; sh: 4,935; ansic: 3,988; makefile: 1,438; perl: 355; javascript: 18
file content (112 lines) | stat: -rw-r--r-- 4,276 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?xml version="1.0" standalone="no"?>
<!--
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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">

<s1 title="Sample: MemParse">

    <s2 title="MemParse">
        <p>MemParse uses the 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>

<source>MemParse -v=always</source>
          <p>The output is the following:</p>
<source>Finished parsing the memory buffer containing the following XML statements:

&lt;?xml version='1.0' encoding='ascii'?&gt;
&lt;!DOCTYPE company [
&lt;!ELEMENT company     (product,category,developedAt)&gt;
&lt;!ELEMENT product     (#PCDATA)&gt;
&lt;!ELEMENT category    (#PCDATA)&gt;
&lt;!ATTLIST category idea CDATA #IMPLIED&gt;
&lt;!ELEMENT developedAt (#PCDATA)&gt;
]&gt;

&lt;company&gt;
  &lt;product&gt;XML4C&lt;/product&gt;
  &lt;category idea='great'&gt;XML Parsing Tools&lt;/category&gt;
  &lt;developedAt&gt;
    IBM Center for Java Technology, Silicon Valley, Cupertino, CA
  &lt;/developedAt&gt;
&lt;/company&gt;

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>
          <p>The output is the following:</p>
<source>Finished parsing the memory buffer containing the following XML statements:

&lt;?xml version='1.0' encoding='ascii'?&gt;
&lt;!DOCTYPE company [
&lt;!ELEMENT company     (product,category,developedAt)&gt;
&lt;!ELEMENT product     (#PCDATA)&gt;
&lt;!ELEMENT category    (#PCDATA)&gt;
&lt;!ATTLIST category idea CDATA #IMPLIED&gt;
&lt;!ELEMENT developedAt (#PCDATA)&gt;
]&gt;

&lt;company&gt;
  &lt;product&gt;XML4C&lt;/product&gt;
  &lt;category idea='great'&gt;XML Parsing Tools&lt;/category&gt;
  &lt;developedAt&gt;
    IBM Center for Java Technology, Silicon Valley, Cupertino, CA
  &lt;/developedAt&gt;
&lt;/company&gt;

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 speed.</note>

        </s3>
    </s2>



</s1>