# XOM Sample Code

Elliotte Rusty Harold
ERH
2004, 2005, 2016, 2018 Elliotte Rusty Harold

The `nu.xom.samples` package contains several dozen example programs showing you how to use various features of XOM. This page organizes the samples by what they demonstrate.

How do I...

Parse an existing document?

- XMLPrinter

- XOMChecker

- DocumentMerger

Parse an existing document with a specific parser?

- CrimsonPrinter

Query a document?

- RSSHeadlines

- ExampleExtractor

- ExampleLister

Create a new document?

- FibonacciXML

- HelloWorld

Create a new document that uses attributes?

- FibonacciAttributes

Create a new document that has a document type declaration?

- ValidFibonacci

Create a new document that uses namespaces?

- HelloNamespaces

- SimpleSVG

- MathMLFibonacci

Store an XML document in a file?

- FibonacciFile

Pretty print an XML document?

- PrettyFibonacci

- PrettyPrinter

- EZSerializer

Preserve base URI information when serializing?

- HelloXMLBase

Modify an XML document?

- IDTagger

- RDDLStripper

- ResourceToTable

- ROT13XML

- XHTMLPurifier

- XHTMLQualifier

Work with attributes?

- XLinkSpider

- AttributesToElements

- IDFilter

- IDTagger

- PropertyPrinter

Move elements from one document to another?

- Linkset

Move nodes from one place in a document to another place in the same document?

- Restructurer

Build a structured XML document from flat, tabular data?

- Account

- Agency

- Bureau

- Budget

- BudgetData

- Subfunction

- AttributesXMLBudget

- FlatXMLBudget

- HierarchicalXMLBudget

Build an XML document from a relational database or other JDBC source?

- DatabaseBuilder

- DatabaseConverter

- SQLToXML

Convert an XML document into a non-XML format?

- SourceCodeGenerator

- SourceCodeSerializer

Extend Serializer?

- SourceCodeSerializer

- TextSerializer

- WrappingSerializer

Use my own subclasses of the standard XOM classes?

Perform an XSL transformation?

- Transformer

Resolve all entity references in a document?

- DocumentMerger

Process a document in streaming mode?

- DTDGenerator

Build a DTD from an instance document?

- DTDGenerator

Write a document in Canonical XML?

- CanonicalizerDriver

Write a document in a particular character set?

- EncodingDemo

- FibonacciEBCDIC

- FibonacciLatin1

Generate a servlet response?

- FibonacciServlet

- FibonacciXOMSOAPServlet

- FibonacciXOMXMLRPCServlet

Talk to a SOAP service?

- FibonacciSOAPClient

Talk to an XML-RPC service?

- FibonacciXMLRPCClient

Process SOAP requests?

- FibonacciXOMSOAPServlet

Process XML-RPC requests?

- FibonacciXOMXMLRPCServlet

Find all the comments in an XML document?

- CommentReader

Read processing instruction data?

- ProcessingInstructionLister

- PseudoAttributes

- PoliteSpider

Validate a document?

- Validator

- PureValidator

- XHTMLValidator

Validate a document against a schema?

- SchemaValidator

Resolve XIncludes?

- XIncludeDriver

Combine consecutive text nodes?

- TextMerger

Save memory?

- PureValidator

- MinimalNodeFactory

- NormalizingFactory

Traverse an XML document in preorder?

- CommentReader

- ElementLister

- NodeLister

- ExampleExtractor

- ExampleLister

- PropertyPrinter

- TreePrinter

- TreeReporter

- TreeViewer

- ProcessingInstructionLister

- IDTagger

- Restructurer

- RDDLStripper

- ROT13XML

- XHTMLPurifier

- XHTMLQualifier

Traverse an XML document in preorder without using recursion?

- NonrecursiveSerializer

Strip the markup from an element, extracting only its text? content?

- ExampleExtractor

- TextExtractor

Traverse an XML document in inorder?

Traverse an XML document in postorder?

Write a custom NodeFactory?

- MinimalNodeFactory

- RDDLFilter

- RDDLToTable

- StreamingXHTMLQualifier

- StreamingXHTMLPurifier

- StreamingTypeCounter

- StreamingTreeReporter

- StreamingTextExtractor

- StreamingROT13

- StreamingProcessingInstructionLister

- StreamingNodeLister

- StreamingExampleExtractor

- StreamingElementLister

- StreamingCommentReader

- RSSHeadlines

Process a document in streaming mode?

- StreamingXHTMLQualifier

- StreamingXHTMLPurifier

- StreamingTypeCounter

- StreamingTreeReporter

- StreamingTextExtractor

- StreamingROT13

- StreamingProcessingInstructionLister

- StreamingNodeLister

- StreamingExampleExtractor

- StreamingElementLister

- StreamingCommentReader

- RSSHeadlines

Modify/filter a document while parsing?

- AttributesToElements

- IDFilter

- NormalizingFactory

- RDDLFilter

- RDDLToTable

Trim whitespace from a document while parsing?

- NormalizingFactory