http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Charter
Release Info

Installation
Download
Build Instructions

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

Source Repository
User Mail Archive
Devel Mail Archive

StdInParse
 

StdInParse demonstrates streaming XML data from standard input.

Running StdInParse
 

The StdInParse sample parses an XML file from standard input and prints out a count of the number of elements in the file. To run StdInParse, enter the following:

StdInParse < <XML file>

The following parameters may be set from the command line

Usage:
    StdInParse [options] < <XML file>

This program demonstrates streaming XML data from standard
input.  It then uses the SAX Parser, and prints the
number of elements, attributes, spaces and characters found
in the input, using SAX API.

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.

-v=always will force validation
-v=never will not use any validation
-v=auto will validate if a DOCTYPE declaration or a schema declaration is present in the XML document

Make sure that you run StdInParse in the samples/data directory.

Here is a sample output from StdInParse:

cd xerces-c2_6_0-linux/samples/data
StdInParse -v=always < personal.xml
stdin: 10 ms (37 elems, 12 attrs, 0 spaces, 268 chars)

Running StdInParse with the validating parser gives a different result because ignorable white-space is counted separately from regular characters.

StdInParse -v=never < personal.xml
stdin: 10 ms (37 elems, 12 attrs, 0 spaces, 268 chars)

Note that the sum of spaces and characters in both versions is the same.

NoteThe time reported by the program may be different depending on your machine processor.



Copyright © 1999-2005 The Apache Software Foundation. All Rights Reserved.