You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
4.2 KiB

  1. <?xml version="1.0" standalone="no"?>
  2. <!--
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. -->
  18. <!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
  19. <s1 title="Sample: MemParse">
  20. <s2 title="MemParse">
  21. <p>MemParse uses the SAX Parser to parse a memory buffer containing
  22. XML statements, and reports the number of elements and attributes found.</p>
  23. <s3 title="Running MemParse">
  24. <p>This program uses the SAX Parser to parse a memory buffer
  25. containing XML statements, and reports the number of elements and attributes
  26. found. </p>
  27. <p>The following parameters may be set from the command line </p>
  28. <source>
  29. Usage:
  30. MemParse [options]
  31. This program uses the SAX Parser to parse a memory buffer
  32. containing XML statements, and reports the number of
  33. elements and attributes found.
  34. Options:
  35. -v=xxx Validation scheme [always | never | auto*].
  36. -n Enable namespace processing. Defaults to off.
  37. -s Enable schema processing. Defaults to off.
  38. -f Enable full schema constraint checking. Defaults to off.
  39. -? Show this help.
  40. * = Default if not provided explicitly.
  41. </source>
  42. <p><em>-v=always</em> will force validation<br/>
  43. <em>-v=never</em> will not use any validation<br/>
  44. <em>-v=auto</em> will validate if a DOCTYPE declaration or a schema declaration is present in the XML document</p>
  45. <p>Here is a sample output from MemParse</p>
  46. <source>MemParse -v=always</source>
  47. <p>The output is the following:</p>
  48. <source>Finished parsing the memory buffer containing the following XML statements:
  49. &lt;?xml version='1.0' encoding='ascii'?&gt;
  50. &lt;!DOCTYPE company [
  51. &lt;!ELEMENT company (product,category,developedAt)&gt;
  52. &lt;!ELEMENT product (#PCDATA)&gt;
  53. &lt;!ELEMENT category (#PCDATA)&gt;
  54. &lt;!ATTLIST category idea CDATA #IMPLIED&gt;
  55. &lt;!ELEMENT developedAt (#PCDATA)&gt;
  56. ]&gt;
  57. &lt;company&gt;
  58. &lt;product&gt;XML4C&lt;/product&gt;
  59. &lt;category idea='great'&gt;XML Parsing Tools&lt;/category&gt;
  60. &lt;developedAt&gt;
  61. IBM Center for Java Technology, Silicon Valley, Cupertino, CA
  62. &lt;/developedAt&gt;
  63. &lt;/company&gt;
  64. Parsing took 10 ms (4 elements, 1 attributes, 16 spaces, 95 characters).</source>
  65. <p>Running MemParse with the validating parser gives a different result because
  66. ignorable white-space is counted separately from regular characters.</p>
  67. <source>
  68. MemParse -v=never</source>
  69. <p>The output is the following:</p>
  70. <source>Finished parsing the memory buffer containing the following XML statements:
  71. &lt;?xml version='1.0' encoding='ascii'?&gt;
  72. &lt;!DOCTYPE company [
  73. &lt;!ELEMENT company (product,category,developedAt)&gt;
  74. &lt;!ELEMENT product (#PCDATA)&gt;
  75. &lt;!ELEMENT category (#PCDATA)&gt;
  76. &lt;!ATTLIST category idea CDATA #IMPLIED&gt;
  77. &lt;!ELEMENT developedAt (#PCDATA)&gt;
  78. ]&gt;
  79. &lt;company&gt;
  80. &lt;product&gt;XML4C&lt;/product&gt;
  81. &lt;category idea='great'&gt;XML Parsing Tools&lt;/category&gt;
  82. &lt;developedAt&gt;
  83. IBM Center for Java Technology, Silicon Valley, Cupertino, CA
  84. &lt;/developedAt&gt;
  85. &lt;/company&gt;
  86. Parsing took 10 ms (4 elements, 1 attributes, 0 spaces, 111 characters).</source>
  87. <p>Note that the sum of spaces and characters in both versions is the same.</p>
  88. <note>The time reported by the system may be different, depending on your
  89. processor speed.</note>
  90. </s3>
  91. </s2>
  92. </s1>