#!/usr/bin/env python

# Copyright (c) 2013, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.

"""Creates the CybOX content for CybOX_URL_Pattern.xml
"""

from cybox.common import AnyURI
from cybox.core import Observables
from cybox.objects.uri_object import URI

def main():
    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    o = Observables(u)
    print o.to_xml(True)

if __name__ == "__main__":
    main()

#!/usr/bin/env python

# Copyright (c) 2013, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.

"""Creates the CybOX content for CybOX_URL_Pattern.xml
"""

from cybox.common import AnyURI
from cybox.core import Observables
from cybox.objects.uri_object import URI


def main():
    v = AnyURI("http://www.example.com/index1.html")
    v.condition = "Equals"

    u = URI()
    u.value = v
    u.type_ = URI.TYPE_URL

    o = Observables(u)
    print o.to_xml(include_namespaces=True)

if __name__ == "__main__":
    main()

Set include_namespaces explicitly