|
SSS - S3 Toolkit 0.9.6
S3 client library and applications
|
Response parser function for XML body and HTTP headers. More...
Data Structures | |
| class | XMLOStream |
| XMLGenerator. Use methods or overloaded subscript operator to insert data into XML tree. More... | |
| class | XMLIStream |
| XML parser, returns array of text elements with the same parent path or an array of parsed XML sub trees. More... | |
Functions | |
| std::string | sss::XMLTag (const std::string &xml, const std::string &tag) |
| Extract and return content of XML tag. | |
| std::vector< std::string > | sss::XMLTags (const std::string &xml, const std::string &tag) |
| Extract and return content of all XML tags matching word. | |
| std::string | sss::XMLTagPath (const std::string &xml, const std::string &path) |
| Extract and return content of XML tag matching hierchical path. | |
| std::string | sss::HTTPHeader (const std::string &headers, const std::string &header) |
| Extract and return HTTP header. | |
| Headers | sss::HTTPHeaders (const std::string &headers) |
| Extract and return HTTP headers as key-value pairs. | |
| MetaDataMap | sss::MetaDataHeaders (const std::string &headers) |
Extract and return x-amz-meta-* headers. | |
| std::string | sss::TrimETag (const std::string &etag) |
| Extract ETag string from returned etag text. | |
| std::string | FindElementText (const std::string &xml, const std::string &element) |
| Return text inside XML tags. | |
| std::string | ParseXMLPath (const std::string &xml, const std::string &path) |
| Extract text under XML path. | |
| std::vector< std::string > | ParseXMLMultiPathText (const std::string &xml, const std::string &prefixPpath, const std::string &suffixPath) |
| Multilevel parsing function: return all elements matching path under prefix. | |
| std::vector< std::unordered_map< std::string, std::string > > | RecordList (const std::string &prefix, const std::unordered_map< std::string, std::vector< std::string > > &domMap) |
| Extract records from DOM Map. | |
| std::unordered_map< std::string, std::vector< std::string > > | ParseXMLPathElementsText (const std::string &xml, const std::string &path) |
| Return all elements at location grouped by element name. | |
| std::unordered_map< std::string, std::vector< std::string > > | DOMToDict (const std::string &xml) |
| Convert XML text to {path, text element array} map. Input. | |
| std::unordered_map< std::string, std::vector< std::string > > | ExtractSubPaths (const std::string &prefix, const std::unordered_map< std::string, std::vector< std::string > > &domMap) |
| Return map of {subpaths with same prefix, {list of text elements under subpaths}}. | |
| std::string | XMLToText (const tinyxml2::XMLDocument &doc, bool header=true, char eol_='\n', int indent=2, std::unordered_map< std::string, std::string > kv={}) |
| Transform DOM into text, replacing matching keywords with values specified in {keyword => value} map. | |
| tinyxml2::XMLElement * | CreatePath (tinyxml2::XMLElement *n, const std::string &path, const std::string &text="") |
| Create XML tree from path format and place it under passed element. I.e. from {"/tag1/tag2", "text"} to "<tag1><tag2>text</tag2></tag1>". | |
| tinyxml2::XMLElement * | CreatePath (tinyxml2::XMLDocument &doc, const std::string &path, const std::string &text="") |
| Create XML tree from path format and place inside document instance. | |
| tinyxml2::XMLElement * | CreatePaths (tinyxml2::XMLElement *n, const std::string &path, const std::vector< std::pair< std::string, std::string > > &paths) |
| Create multiple XML trees under element. Invokes CreatePath multiple times passing {path, text} value at each invocation. | |
| tinyxml2::XMLElement * | CreatePaths (tinyxml2::XMLDocument &doc, const std::string &path, const std::vector< std::pair< std::string, std::string > > &paths) |
Create multiple XML trees inside tynyxml2 XML document. Invokes CreatePath multiple times passing {path, text} value at each invocation. | |
| std::string | Get (const XMLRecord &r, const std::string &path) |
Response parser function for XML body and HTTP headers.
High level XML parsing functions using filepath like input.
| tinyxml2::XMLElement * CreatePath | ( | tinyxml2::XMLElement * | n, |
| const std::string & | path, | ||
| const std::string & | text = "" |
||
| ) |
Create XML tree from path format and place it under passed element. I.e. from {"/tag1/tag2", "text"} to "<tag1><tag2>text</tag2></tag1>".
| [in] | n | pointer to root element |
| [in] | path | textual representation of XML path |
| [in] | text | text element to append to path |
| tinyxml2::XMLElement * CreatePaths | ( | tinyxml2::XMLDocument & | doc, |
| const std::string & | path, | ||
| const std::vector< std::pair< std::string, std::string > > & | paths | ||
| ) |
Create multiple XML trees inside tynyxml2 XML document. Invokes CreatePath multiple times passing {path, text} value at each invocation.
| [in] | n | root element |
| [in] | path | XML path in "/.../..." format |
| [in] | paths | list of {path, text element value} to pass to CreatePath |
| tinyxml2::XMLElement * CreatePaths | ( | tinyxml2::XMLElement * | n, |
| const std::string & | path, | ||
| const std::vector< std::pair< std::string, std::string > > & | paths | ||
| ) |
Create multiple XML trees under element. Invokes CreatePath multiple times passing {path, text} value at each invocation.
| [in] | n | root element |
| [in] | path | XML path in "/.../..." format |
| [in] | paths | list of {path, text element value} to pass to CreatePath |
| std::unordered_map< std::string, std::vector< std::string > > DOMToDict | ( | const std::string & | xml | ) |
Convert XML text to {path, text element array} map. Input.
Output
| [in] | xml | XML text |
| std::unordered_map< std::string, std::vector< std::string > > ExtractSubPaths | ( | const std::string & | prefix, |
| const std::unordered_map< std::string, std::vector< std::string > > & | domMap | ||
| ) |
Return map of {subpaths with same prefix, {list of text elements under subpaths}}.
Input
Output
| [in] | prefix | XML prefix in path format: "/.../..." |
| [in] | domMap | DOM document in {prefix => text value} format |
prefix | std::string FindElementText | ( | const std::string & | xml, |
| const std::string & | element | ||
| ) |
Return text inside XML tags.
| [in] | xml | XML text. |
| [in] | element | name of XML tag to search for. |
|
inline |
Extract string from map
| [in] | r | XMLRecord instance |
| [in] | path | key in the form "/tag1/tag11..." |
| std::string sss::HTTPHeader | ( | const std::string & | headers, |
| const std::string & | header | ||
| ) |
Extract and return HTTP header.
| [in] | headers | text containing the header section of an HTTP payload |
| [in] | header | header name |
Here is the caller graph for this function:| Headers sss::HTTPHeaders | ( | const std::string & | headers | ) |
Extract and return HTTP headers as key-value pairs.
| [in] | headers | text containing the header section of an HTTP payload |
std::map<std::string, std::string> of {header name, header value} tuples
Here is the caller graph for this function:| MetaDataMap sss::MetaDataHeaders | ( | const std::string & | headers | ) |
Extract and return x-amz-meta-* headers.
| [in] | headers | text containing the header section of an HTTP payload |
std::map<std::string, std::string> of {header name, header value} tuples | std::vector< std::string > ParseXMLMultiPathText | ( | const std::string & | xml, |
| const std::string & | prefixPpath, | ||
| const std::string & | suffixPath | ||
| ) |
Multilevel parsing function: return all elements matching path under prefix.
E.g.
If prefix is "/tag1/tag11" and suffix is "/name" it will extract text from all the <name>Name one</name><name>Name two</name> elements inside <tag1><tag2>..</tag2></tag1 equivalent to:
It groups text elements by XML prefix, mapping prefix to multiple text elements.
| [in] | xml | XML text. |
| [in] | prefixPath | starting path from element extraction. |
| [in] | suffixPath | return all text elements matching suffixPath path under prefixPath. |
/prefixPath/suffixPath/ | std::string ParseXMLPath | ( | const std::string & | xml, |
| const std::string & | path | ||
| ) |
Extract text under XML path.
| [in] | XML | text. |
| [in] | path | path to XML tag in the format "/tag1/tag11/tag112...". |
| std::unordered_map< std::string, std::vector< std::string > > ParseXMLPathElementsText | ( | const std::string & | xml, |
| const std::string & | path | ||
| ) |
Return all elements at location grouped by element name.
Input
Output
| [in] | xml | XML text |
| [in] | path | path to elements: "/tag1/tag12/...." |
| std::vector< std::unordered_map< std::string, std::string > > RecordList | ( | const std::string & | prefix, |
| const std::unordered_map< std::string, std::vector< std::string > > & | domMap | ||
| ) |
Extract records from DOM Map.
Input:
domMap = XML text -> DOMToDict -> {"/listbucketresult/contents/key", "Key1"}...prefixPath = "/listbucketresult/contents"Output
If the case insensitive flag is set (default) then all tag names are converted to lowercase.
Transpose operation:
FROM:
TO:
| [in] | prefix | XML path to record data. |
| [in] | domMap | XML document transformed into {"path", "text"} map through DOMToDict function. |
Here is the caller graph for this function:| std::string sss::TrimETag | ( | const std::string & | etag | ) |
Extract ETag string from returned etag text.
| [in] | etag | etag text |
| std::string sss::XMLTag | ( | const std::string & | xml, |
| const std::string & | tag | ||
| ) |
Extract and return content of XML tag.
| [in] | xml | XML text |
| [in] | tag | <tag> name |
<tag> content
Here is the caller graph for this function:| std::string sss::XMLTagPath | ( | const std::string & | xml, |
| const std::string & | path | ||
| ) |
Extract and return content of XML tag matching hierchical path.
| [in] | xml | XML text |
| [in] | path | tag path separated by '/' character |
| std::vector< std::string > sss::XMLTags | ( | const std::string & | xml, |
| const std::string & | tag | ||
| ) |
Extract and return content of all XML tags matching word.
| [in] | xml | XML text |
| [in] | tag | <tag> name |
content of each tag matching name | std::string XMLToText | ( | const tinyxml2::XMLDocument & | doc, |
| bool | header = true, |
||
| char | eol_ = '\n', |
||
| int | indent = 2, |
||
| std::unordered_map< std::string, std::string > | kv = {} |
||
| ) |
Transform DOM into text, replacing matching keywords with values specified in {keyword => value} map.
| [in] | doc | XML document in tinyxml2 format |
| [in] | kv | keyword => value map, keywords are replaced with values in translated text |
| [in] | header | if true addx the <xml...> header |
| [in] | eol | end of line separator, default is ' ', if '0' no EOL generated |
| [in] | indent | indentation value |
Here is the caller graph for this function: