oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #01084
Re: XMLSchemas openEHR version 1.0.2
Hi Tarsis,
We use PyXB in OSHIP to create bindings for SDMX-HD and NHIN CONNECT. I
suggest that you use it as well. http://pyxb.sourceforge.net/ It is a
great tool. I have already created the bindings for the schemas. See:
http://www.mlhim.org/schemas/openehr/v1/schemas_python_binindings.tar.gz
(even if I did misspell the name).
If you need help integrating it into HKCR then let us know.
You can then do validation something like:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import archetype
>>> import pyxb.utils.domutils as domutils
>>> xml=file('openEHR-EHR-OBSERVATION.apgar.v1.xml').read()
>>> doc = domutils.StringToDOM(xml)
>>> doc
<pyxb.utils.saxdom.Document object at 0x2362dd0>
At this point you know it validated through the SAXparser.
Then you can use it as an instance to collect data, etc. if you like.
The are a number of examples on the PyXB site to demonstrate what you
can do with the documents.
HTH,
Tim
PS.Please use Reply-All so that the emails are archived for future
searches, etc. This will help others that come along after us.
On Mon, 2010-06-21 at 21:40 -0300, Tarsis Azevedo wrote:
> Hi Tim, i trying validate xml file with xsd files from milihm.org .
> This is my output:
>
>
> In [2]: archetype_file =
> open('/home/tarsis/XML-schema/xsds/Archetype.xsd', 'r')
>
>
> In [3]: archetype = lxml.etree.parse(archetype_file)
>
>
> In [4]: from lxml import etree
>
>
> In [5]: archetype = etree.parse(archetype_file)
>
>
> In [6]: archetype
> Out[6]: <lxml.etree._ElementTree object at 0x91f47ec>
>
>
> In [7]: archetype_file.close()
>
>
> In [8]: xsd =
> open('/home/tarsis/XML-schema/openEHR-EHR-ACTION.procedure.v1.xml',
> 'r')
>
>
> In [9]: xsd
> Out[9]: <open file
> '/home/tarsis/XML-schema/openEHR-EHR-ACTION.procedure.v1.xml', mode
> 'r' at 0x91ee930>
>
>
> In [10]: archetype
> Out[10]: <lxml.etree._ElementTree object at 0x91f47ec>
>
>
> In [11]: archetype_file
> Out[11]: <closed file '/home/tarsis/XML-schema/xsds/Archetype.xsd',
> mode 'r' at 0x9088ca0>
>
>
> In [12]: archetype2 = etree.parse(xsd)
>
>
> In [13]: xsd.close()
>
>
> In [14]: schema = etree.XMLSchema(archetype)
>
>
> In [15]: schema.validate(archetype2)
> Out[15]: False
>
>
> This is the XSD i use to validate xmls?!
>
>
> Thanks
> Tarsis Figueredo Azevedo.
> -------------------
> Linux User: #496982
> -------------------
>
> "Any fool can write code that a computer can understand. Good
> programmers write code that humans can understand.
>
> -Martin Fowler, Refactoring: Improving the Design of Existing Code"
>
>
> 2010/6/18 Tarsis Azevedo <tarsis.azevedo@xxxxxxxxx>
> Ok Tim, excuse the delay. I will try with these.
>
>
> Sorry,
>
>
> [],
> Tarsis Figueredo Azevedo.
> -------------------
> Linux User: #496982
> -------------------
>
> "Any fool can write code that a computer can understand. Good
> programmers write code that humans can understand.
>
> -Martin Fowler, Refactoring: Improving the Design of Existing
> Code"
>
>
> 2010/6/10 Tim Cook <timothywayne.cook@xxxxxxxxx>
>
> Hi Tarsis,
>
> The schemas are now on MLHIM.org. You can download
> them from the links
> below. They were validated with the W3C Schema
> validator at:
> http://www.w3.org/2001/03/webdata/xsv
>
> I believe that all of the includes are correct.
>
> Cheers,
> Tim
>
> The output is below:
>
> ==========================================================
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> ==========================================================
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Template.xsd
> (source: command line) for
> no namespace,
> succeeded
> ==========================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Composition.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Content.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Structure.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/OpenehrProfile.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Archetype.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Resource.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Structure.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Extract.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Version.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Composition.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Content.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Structure.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Resource.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
>
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Version.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Composition.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Content.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Structure.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> ==================================================================
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Archetype.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Resource.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
> ==================================================================
>
> Schema resources involved
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Content.xsd
> (source: command line) for
> no namespace,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/Structure.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
> Attempt to load a schema document from
> http://www.mlhim.org/schemas/openehr/v1/BaseTypes.xsd
> (source: include) for
> http://www.mlhim.org/schemas/openehr/v1,
> succeeded
>
>
>
> --
> ***************************************************************
> Timothy Cook, MSc
>
> LinkedIn
> Profile:http://www.linkedin.com/in/timothywaynecook
> Skype ID == (upon request)
> Academic.Edu Profile:
> http://uff.academia.edu/TimothyCook
>
> You may get my Public GPG key from popular keyservers
> or
> from this link
> http://timothywayne.cook.googlepages.com/home
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~oship-dev
> Post to : oship-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~oship-dev
> More help : https://help.launchpad.net/ListHelp
>
>
>
>
>
--
***************************************************************
Timothy Cook, MSc
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == (upon request)
Academic.Edu Profile: http://uff.academia.edu/TimothyCook
You may get my Public GPG key from popular keyservers or
from this link http://timothywayne.cook.googlepages.com/home
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups
References