1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::XML::InputSource</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.XML.html" class="namespace">Poco::XML</a></h1>
<h1 class="symbol">class InputSource</h1>
</div>
<div class="body">
<p>
<b>Library:</b> XML<br />
<b>Package:</b> SAX<br />
<b>Header:</b> Poco/SAX/InputSource.h</p>
<h2>Description</h2>
<div class="description">
<p>This class allows a SAX application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), and/or a character stream. </p>
<p>There are two places that the application can deliver an input source to the parser: as the argument to the Parser.parse method, or as the return value of the <a href="Poco.XML.EntityResolver.html#18967" title="Poco::XML::EntityResolver::resolveEntity()">EntityResolver::resolveEntity</a>() method. </p>
<p>The SAX parser will use the <a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a> object to determine how to read <a href="Poco.XML.html" title="namespace Poco::XML">XML</a> input. If there is a character stream available, the parser will read that stream directly, disregarding any text encoding declaration found in that stream. If there is no character stream, but there is a byte stream, the parser will use that byte stream, using the encoding specified in the <a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a> or else (if no encoding is specified) autodetecting the character encoding using an algorithm such as the one in the <a href="Poco.XML.html" title="namespace Poco::XML">XML</a> specification. If neither a character stream nor a byte stream is available, the parser will attempt to open a <a href="Poco.URI.html" title="class Poco::URI">URI</a> connection to the resource identified by the system identifier. </p>
<p>An <a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a> object belongs to the application: the SAX parser shall never modify it in any way (it may modify a copy if necessary). However, standard processing of both byte and character streams is to close them on as part of end-of-parse cleanup, so applications should not attempt to re-use such streams after they have been handed to a parser. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.XML.InputSource.html#19013" title="Poco::XML::InputSource::getByteStream()">getByteStream</a>, <a href="Poco.XML.InputSource.html#19016" title="Poco::XML::InputSource::getCharacterStream()">getCharacterStream</a>, <a href="Poco.XML.InputSource.html#19019" title="Poco::XML::InputSource::getEncoding()">getEncoding</a>, <a href="Poco.XML.InputSource.html#19009" title="Poco::XML::InputSource::getPublicId()">getPublicId</a>, <a href="Poco.XML.InputSource.html#19010" title="Poco::XML::InputSource::getSystemId()">getSystemId</a>, <a href="Poco.XML.InputSource.html#19011" title="Poco::XML::InputSource::setByteStream()">setByteStream</a>, <a href="Poco.XML.InputSource.html#19014" title="Poco::XML::InputSource::setCharacterStream()">setCharacterStream</a>, <a href="Poco.XML.InputSource.html#19017" title="Poco::XML::InputSource::setEncoding()">setEncoding</a>, <a href="Poco.XML.InputSource.html#19005" title="Poco::XML::InputSource::setPublicId()">setPublicId</a>, <a href="Poco.XML.InputSource.html#19007" title="Poco::XML::InputSource::setSystemId()">setSystemId</a></p>
<h2>Constructors</h2>
<h3><a name="18999">InputSource</a></h3>
<p class="decl"><a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a>();</p>
<div class="description">
<p>Zero-argument default constructor. </p>
</div>
<h3><a name="19000">InputSource</a></h3>
<p class="decl"><a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a>(<br /> const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & systemId<br />);</p>
<div class="description">
<p>Creates a new input source with a system identifier. Applications may use setPublicId to include a public identifier as well, or setEncoding to specify the character encoding, if known. </p>
<p>If the system identifier is a URL, it must be fully resolved (it may not be a relative URL). </p>
</div>
<h3><a name="19002">InputSource</a></h3>
<p class="decl"><a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a>(<br /> <a href="Poco.XML.html#19836" title="Poco::XML::XMLByteInputStream">XMLByteInputStream</a> & istr<br />);</p>
<div class="description">
<p>Creates a new input source with a byte stream. </p>
<p>Application writers should use <a href="Poco.XML.InputSource.html#19007" title="Poco::XML::InputSource::setSystemId()">setSystemId</a>() to provide a base for resolving relative URIs, may use setPublicId to include a public identifier, and may use setEncoding to specify the object's character encoding. </p>
</div>
<h2>Destructor</h2>
<h3><a name="19004">~InputSource</a></h3>
<p class="decl">~<a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.XML.InputSource.html" title="class Poco::XML::InputSource">InputSource</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="19013">getByteStream</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.html#19836" title="Poco::XML::XMLByteInputStream">XMLByteInputStream</a> * getByteStream() const;</p>
<div class="description">
<p>Get the byte stream for this input source. </p>
</div>
<h3><a name="19016">getCharacterStream</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.XML.html#19838" title="Poco::XML::XMLCharInputStream">XMLCharInputStream</a> * getCharacterStream() const;</p>
<div class="description">
<p>Get the character stream for this input source. </p>
</div>
<h3><a name="19019">getEncoding</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & getEncoding() const;</p>
<div class="description">
<p>Get the character encoding for a byte stream or <a href="Poco.URI.html" title="class Poco::URI">URI</a>. </p>
</div>
<h3><a name="19009">getPublicId</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & getPublicId() const;</p>
<div class="description">
<p>Get the public identifier for this input source. </p>
</div>
<h3><a name="19010">getSystemId</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & getSystemId() const;</p>
<div class="description">
<p>Get the system identifier for this input source. </p>
</div>
<h3><a name="19011">setByteStream</a></h3>
<p class="decl">void setByteStream(<br /> <a href="Poco.XML.html#19836" title="Poco::XML::XMLByteInputStream">XMLByteInputStream</a> & istr<br />);</p>
<div class="description">
<p>Set the byte stream for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a <a href="Poco.URI.html" title="class Poco::URI">URI</a> connection itself. </p>
</div>
<h3><a name="19014">setCharacterStream</a></h3>
<p class="decl">void setCharacterStream(<br /> <a href="Poco.XML.html#19838" title="Poco::XML::XMLCharInputStream">XMLCharInputStream</a> & istr<br />);</p>
<div class="description">
<p>Set the character stream for this input source. </p>
</div>
<h3><a name="19017">setEncoding</a></h3>
<p class="decl">void setEncoding(<br /> const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & encoding<br />);</p>
<div class="description">
<p>Set the character encoding, if known. The encoding must be a string acceptable for an <a href="Poco.XML.html" title="namespace Poco::XML">XML</a> encoding declaration (see section 4.3.3 of the <a href="Poco.XML.html" title="namespace Poco::XML">XML</a> 1.0 recommendation). </p>
</div>
<h3><a name="19005">setPublicId</a></h3>
<p class="decl">void setPublicId(<br /> const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & publicId<br />);</p>
<div class="description">
<p>Set the public identifier for this input source. </p>
<p>The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information. </p>
</div>
<h3><a name="19007">setSystemId</a></h3>
<p class="decl">void setSystemId(<br /> const <a href="Poco.XML.html#19841" title="Poco::XML::XMLString">XMLString</a> & systemId<br />);</p>
<div class="description">
<p>Set the system identifier for this input source. </p>
<p>The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the <a href="Poco.URI.html" title="class Poco::URI">URI</a> only if there is no byte stream or character stream specified). </p>
<p>If the application knows the character encoding of the object pointed to by the system identifier, it can register the encoding using the setEncoding method. </p>
<p>If the system identifier is a URL, it must be fully resolved (it may not be a relative URL). </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|