On Thu, Apr 09, 2015 at 03:07:44PM +0200, Marius Räsener wrote: > in first place, thx for the generateDS Tool. I’m not sure yet but it > seems it could solve „all“ my GAEB XML related issues. > > GAEB Files are a german craft related files - to make proposals, > invoices and that kind of stuff. Usually architects use them, but > it’s intended to be used by every affected company or partner. > > anyway, I want to write a Import Function for *.x83 Files (83 means > a Proposal, or better a Proposal request). > > For this I was hoping I can use the two related XSD Files, convert > them with generateDS, and „just“ have the thing working :) > > There is a GAEB_DA_XML_Lib_3.2_2013-10.xsd „Lib“ File and the „x83“ > GAEB_DA_XML_83_3.2_2013-10.xsd File. > > Within the x83 File there is a reference to the Lib via <xs:redefine > schemaLocation="GAEB_DA_XML_Lib_3.2_2013-10.xsd“> > > Can I use generateDS with that somehow? … fyi I could have converted > the Lib File, but so far no Luck with the x83
Marius, I have to admit (too) that, until now, I was not aware of the xs:redefine feature in XML Schema. So, now I've read about it in the book "Definitive XML Schema", by Priscila Walmsley (the book is rather old but helpful) and also at http://www.w3.org/TR/xmlschema-0/#Redefine. Basically, what xs:redefine does is (1) include the referenced file (from schemaLocation) and replace any definitions that are within the xs:redefine element. It also (2) replaces the use of any of the new, redefined definitions in the elements included from the referenced file. It's that second bit (replacing old definitions with redefined ones), that would be difficult in generateDS.py. (generateDS.py already does something analogous to the first part: include the referenced schema in a way similar to xs:include.) So, no, generateDS.py does not support this feature. And, because of the requirement to replace references in the redefined schema with (redefined) definitions from the redefining schema, this would be a difficult new feature to support. I'll look into it. But, I'm not optimistic. Have you considered using lxml.objectify? It looks to me that it does much of what generateDS.py does. For some use cases, it's easier to use; for others, perhaps not. For example, reading and parsing an XML document and then exporting it (something we frequently do with code generated by generateDS.py is trivial. Here is some sample code using lxml.objectify: import sys from lxml import etree, objectify def test(infilename): # parse the XML doc; build a tree doc = objectify.parse(infilename) root = doc.getroot() # display the children of the root element print list(root) # get the second child element whose tag is "default2" child = root.default2[1] # display the attributes of a child element print child.attrib print child.attrib.get('attrdefault01') # print out (serialize, export) the document print '-' * 50 print etree.tostring(root) # export it pretty printed print '-' * 50 doc.write(sys.stdout, pretty_print=True) # export it pretty printed and with an XML declaration print '-' * 50 doc.write(sys.stdout, pretty_print=True, xml_declaration=True) I've written a document that gives some guidance about using objectify: http://www.davekuhlman.org/objectify_notes.html And, the official documentation is here: http://lxml.de/objectify.html If it is not so obvious how to get your tasks done with lxml.objectify, give me a brief description of what you need to do. I might be able to make a suggestion. I'm not an expert on objectify, but it does make many things quite straight forward. > > Thx in advance for any hints or comments or even the actual solution :) > > I have to admit I’m quite new to this (XML in particular) and so far > I couldn’t find a way to import a Proposal request. > > Besides, for the long run of my Project, it would be nice to „fully“ > Support the GAEB Standard, whatever that means :) > > the files in the attachement are from here > http://www.gaeb-da-xml.de/ <http://www.gaeb-da-xml.de/> or actually > http://www.gaeb-da-xml.de/v32/Documents/Leistungsverzeichnis_3.2_2013-10.zip Thanks for the links and the schema. It's an interesting feature, even if generateDS.py does not support it. Maybe someday ... Dave -- Dave Kuhlman http://www.davekuhlman.org ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users