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.

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