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.

73 lines
3.3 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: SAX2Count">
  20. <s2 title="SAX2Count">
  21. <p>SAX2Count is a simple application that counts the elements and characters of
  22. a given XML file using the (event based) SAX2 API.</p>
  23. <s3 title="Running SAX2Count">
  24. <p>The SAX2Count sample parses an XML file and prints out the number of
  25. elements and characters in the file. To run SAX2Count, enter the following </p>
  26. <source>SAX2Count &lt;XML File&gt;</source>
  27. <p>The following parameters may be set from the command line </p>
  28. <source>
  29. Usage:
  30. SAX2Count [options] &lt;XML file | List file&gt;
  31. This program invokes the SAX2XMLReader, and then prints the
  32. number of elements, attributes, spaces and characters found
  33. in each XML file, using SAX2 API.
  34. Options:
  35. -l Indicate the input file is a List File that has a list of xml files.
  36. Default to off (Input file is an XML file).
  37. -v=xxx Validation scheme [always | never | auto*].
  38. -f Enable full schema constraint checking processing. Defaults to off.
  39. -n Disable namespace processing. Defaults to on.
  40. NOTE: THIS IS OPPOSITE FROM OTHER SAMPLES.
  41. -s Disable schema processing. Defaults to on.
  42. NOTE: THIS IS OPPOSITE FROM OTHER SAMPLES.
  43. -locale=ll_CC specify the locale, default: en_US
  44. -? Show this help.
  45. * = Default if not provided explicitly.
  46. </source>
  47. <p><em>-v=always</em> will force validation<br/>
  48. <em>-v=never</em> will not use any validation<br/>
  49. <em>-v=auto</em> will validate if a DOCTYPE declaration or a schema declaration is present in the XML document</p>
  50. <p>Here is a sample output from SAX2Count</p>
  51. <source>cd &XercesC3InstallDir;/samples/data
  52. SAX2Count -v=always personal.xml
  53. personal.xml: 60 ms (37 elems, 12 attrs, 134 spaces, 134 chars)</source>
  54. <p>Running SAX2Count with the validating parser gives a different result because
  55. ignorable white-space is counted separately from regular characters.</p>
  56. <source>SAX2Count -v=never personal.xml
  57. personal.xml: 10 ms (37 elems, 12 attrs, 0 spaces, 268 chars)</source>
  58. <p>Note that the sum of spaces and characters in both versions is the same.</p>
  59. <note>The time reported by the program may be different depending on your
  60. processor speed.</note>
  61. </s3>
  62. </s2>
  63. </s1>