Table of Contents
To manage XML documents in BDB XML, you must load them into a container.
Typically you will do this by using the XmlContainer
handle directly. You can also load a document into an
XmlDocument
instance, and then load that instance
into the container using the XmlContainer
handle. This book will mostly use the first, most direct, method.
When you add a document to a container, you must identify the location where the document resides. You can do this by using:
A string object that holds the entire document.
An input stream that is created from a filename.
Use
XmlManager::createLocalFileInputStream()
to create the input stream.
An input stream created from a URL. In this case, the URL can be any valid URL. However, if the URL requires network activity in order to access the identified content (such as is required if you, for example, supply an HTTP URL), then the input stream is valid only if you have compiled Xerces with socket support.
Use
XmlManager::createURLInputStream()
to create the input stream.
An input stream that refers to a memory buffer.
Use
XmlManager::createMemBufInputStream()
to create the input stream.
An input stream that refers to standard input (the console under Windows systems).
Use
XmlManager::createStdInInputStream()
to create the input stream.
Note that BDB XML does not validate an input stream until you actually attempt to put the document to your container. This means that you can create an input stream to an invalid location or to invalid content, and BDB XML will not throw an exception until you actually attempt to load data from that location.
We provide an example of creating input streams in the following section.