Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




Building Xerces-C

DOMPrint

DOMPrint parses an XML file, constructs the DOM tree, and walks through the tree printing each element. It thus dumps the XML back (output same as SAXPrint).

Building on Windows

Load the xerces-c1_4_0-win32\samples\Projects\Win32\VC6\samples.dsw Microsoft Visual C++ workspace inside your MSVC IDE. Then build the project marked DOMPrint.

Building on UNIX

cd xerces-c1_4_0-linux/samples
./runConfigure -p<platform> -c<C_compiler> -x<C++_compiler>
cd DOMPrint
gmake

This will create the object files in the current directory and the executable named DOMPrint in 'xerces-c1_4_0-linux/bin' directory.

To delete all the generated object files and executables, type

gmake clean

Running DOMPrint

The DOMPrint sample parses an XML file, using either a validating or non-validating DOM parser configuration, builds a DOM tree, and then walks the tree and outputs the contents of the nodes in a 'canonical' format. To run DOMPrint, enter the following:

DOMPrint <XML file>

The following parameters may be set from the command line

Usage: DOMPrint [options] file

This program invokes the Xerces-C DOM parser and builds the DOM
tree. It then traverses the DOM tree and prints the contents
of the tree. Options are NOT case sensitive.

Options:
    -e          Expand entity references. Default is no expansion.
    -u=xxx      Handle unrepresentable chars [fail | rep | ref*]
    -v=xxx      Validation scheme [always | never | auto*]
    -n          Enable namespace processing. Default is off.
    -x=XXX      Use a particular encoding for output. Default is
                the same encoding as the input XML file. UTF-8 if
                input XML file has not XML declaration.
    -?          Show this help (must be the only parameter)

  * = Default if not provided explicitly

The parser has intrinsic support for the following encodings:
    UTF-8, USASCII, ISO8859-1, UTF-16[BL]E, UCS-4[BL]E,
    WINDOWS-1252, IBM1140, IBM037

-u=fail will fail when unrepresentable characters are encountered
-u=rep will replace with the substitution character for that codepage
-u=ref will report the character as a reference

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

Here is a sample output from DOMPrint

cd xerces-c1_4_0-linux/samples/data
DOMPrint -v personal.xml

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE personnel SYSTEM "personal.dtd">
<!-- @version: -->
<personnel>

<person id="Big.Boss">
  <name><family>Boss</family> <given>Big</given></name>
  <email>chief@foo.com</email>
  <link subordinates="one.worker two.worker three.worker
                         four.worker five.worker"></link>
</person>

<person id="one.worker">
  <name><family>Worker</family> <given>One</given></name>
  <email>one@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

<person id="two.worker">
  <name><family>Worker</family> <given>Two</given></name>
  <email>two@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

<person id="three.worker">
  <name><family>Worker</family> <given>Three</given></name>
  <email>three@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

<person id="four.worker">
  <name><family>Worker</family> <given>Four</given></name>
  <email>four@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

<person id="five.worker">
  <name><family>Worker</family> <given>Five</given></name>
  <email>five@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

</personnel>

Note that DOMPrint does not reproduce the original XML file. DOMPrint and SAXPrint produce different results because of the way the two APIs store data and capture events.

Copyright © 2000 The Apache Software Foundation. All Rights Reserved.



With any suggestions or questions please feel free to contact us