Title: Documentation: · Issue #250 · STIXProject/python-stix · GitHub
Open Graph Title: Documentation: · Issue #250 · STIXProject/python-stix
X Title: Documentation: · Issue #250 · STIXProject/python-stix
Description: http://stix.readthedocs.org/en/stable/getting_started.html#parsing-stix-xml I was reading this in the context of parsing STIX out of a libtaxii object. I think it would be nice if the example included getting a handle on a STIX document ...
Open Graph Description: http://stix.readthedocs.org/en/stable/getting_started.html#parsing-stix-xml I was reading this in the context of parsing STIX out of a libtaxii object. I think it would be nice if the example inclu...
X Description: http://stix.readthedocs.org/en/stable/getting_started.html#parsing-stix-xml I was reading this in the context of parsing STIX out of a libtaxii object. I think it would be nice if the example inclu...
Opengraph URL: https://github.com/STIXProject/python-stix/issues/250
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Documentation: ","articleBody":"http://stix.readthedocs.org/en/stable/getting_started.html#parsing-stix-xml\n\nI was reading this in the context of parsing STIX out of a libtaxii object. I think it would be nice if the example included getting a handle on a STIX document out of libtaxii.\n\nFor instance, take this stub Inbox Message:\n\n``` xml\n\u003ctaxii_11:Inbox_Message xmlns:taxii_11=\"http://taxii.mitre.org/messages/taxii_xml_binding-1.1\"\n message_id=\"1\"\u003e\n \u003ctaxii_11:Content_Block\u003e\n \u003ctaxii_11:Content_Binding binding_id=\"urn:stix.mitre.org:xml:1.1.1\"/\u003e\n \u003ctaxii_11:Content\u003e\n \u003cstix:STIX_Package xmlns:stix=\"http://stix.mitre.org/stix-1\" version=\"1.1.1\"/\u003e\n \u003c/taxii_11:Content\u003e\n \u003c/taxii_11:Content_Block\u003e\n\u003c/taxii_11:Inbox_Message\u003e\n```\n\nTo get a libtaxii handle on the message, you'd do (I did not double check to see if this is well documented or not, so perhaps there's a corresponding issue for libtaxii...):\n\n``` python\nimport libtaxii.messages_11 as tm11\ntaxii_xml = '\u003ctaxii_11:Inbox_Message\u003e...\u003c/taxii_11:Inbox_Message\u003e' # Use the above XML\nmsg = tm11.InboxMessage.from_xml(taxii_xml)\n# This prints out the STIX XML\nprint msg.content_blocks[0].content\n```\n\nHowever, there's no obvious/documented connection to how to get a `stix.core.STIXPackage` object from here. I ended up with:\n\n``` python\nfrom StringIO import StringIO\nfrom stix.core import STIXPackage\npackage = STIXPackage(StringIO(msg.content_blocks[0].content))\n# \u003cstix.core.stix_package.STIXPackage object at 0x7f6d19d6a5d0\u003e\n```\n\nThis issue has a couple items:\n1. Is this right? Or is there a cleaner way to go from `libtaxii` to `python-stix`\n2. Whatever the \"right\" way is, it probably makes sense to add it to RTD\n3. If it makes sense, I could add a mechanism to libtaxii to get the content etree directly (currently possible, but hacky).\n\nThank you.\n-Mark\n","author":{"url":"https://github.com/MarkDavidson","@type":"Person","name":"MarkDavidson"},"datePublished":"2015-04-06T16:43:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/250/python-stix/issues/250"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2dc65768-737b-af28-401f-9801fd8bbb51 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F94:355A4F:1926550:2189103:697040D5 |
| html-safe-nonce | 05c3476c3599d4f6e427d19b27d633558f99c558e76149aab3155124c9d453ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Rjk0OjM1NUE0RjoxOTI2NTUwOjIxODkxMDM6Njk3MDQwRDUiLCJ2aXNpdG9yX2lkIjoiNzE0NjIxNTQyNjM3Mzk5MjY2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 56a87334f8e7e780acf6442c5cac8d56a5c987fa2dd868dea467cc1a4c526dd1 |
| hovercard-subject-tag | issue:66648304 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/STIXProject/python-stix/250/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7a6aaf5b987a39b03f46ca0a8fe12635dab2c7f6c0c44f1312faaac78031eb42/STIXProject/python-stix/issues/250 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7a6aaf5b987a39b03f46ca0a8fe12635dab2c7f6c0c44f1312faaac78031eb42/STIXProject/python-stix/issues/250 |
| og:image:alt | http://stix.readthedocs.org/en/stable/getting_started.html#parsing-stix-xml I was reading this in the context of parsing STIX out of a libtaxii object. I think it would be nice if the example inclu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MarkDavidson |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/STIXProject/python-stix git https://github.com/STIXProject/python-stix.git |
| octolytics-dimension-user_id | 2774079 |
| octolytics-dimension-user_login | STIXProject |
| octolytics-dimension-repository_id | 8163746 |
| octolytics-dimension-repository_nwo | STIXProject/python-stix |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 8163746 |
| octolytics-dimension-repository_network_root_nwo | STIXProject/python-stix |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f643964067a552f02067066d6a910b2f90a5721f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width