delphi - How to ease extraction of meticulously specified XML data? -
there xml data files need extract data from, along xsd describes structure. uses lots of complex types couple of namespaces, use more complex types more namespaces , on. after flattening, still 120 xsds used.
here's xsd:
copyright (c) un/cefact (2008). rights reserved. document , translations of may copied , furnished others, , derivative works comment on or otherwise explain or assist in implementation may prepared, copied, published , distributed, in whole or in part, without restriction of kind, provided above copyright notice , paragraph included on such copies , derivative works. however, document may not modified in way, such removing copyright notice or references un/cefact, except needed purpose of developing un/cefact specifications, in case procedures copyrights defined in un/cefact intellectual property rights document must followed, or required translate languages other english. limited permissions granted above perpetual , not revoked un/cefact or successors or assigns. document , information contained herein provided on "as is" basis , un/cefact disclaims warranties, express or implied, including not limited warranty use of information herein not infringe rights or implied warranties of merchantability or fitness particular purpose. --> <!-- schema agency: florecom / floricode schema version: 0.10 schema date: 27 september 2013 copyright (c) florecom / floricode (2013). rights reserved. sierteelt invoice 20110510 hvr upgrade new florecom library rabie4p0 20110831 hvr upgrade development library rabie5p0 pilot floraholland invoice, added payerparty, invoicerparty 20120507 hvr library 2012 juli. 20120612 hvr upgrade new florecom library rabie6p0. 20130927 hvr upgrade new florecom / floricode liberary rabie7p0, added clearingagent. --> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:feccii="urn:fec:florecom:xml:data:draft:crossindustryinvoice:10" xmlns:ram="urn:un:unece:uncefact:data:standard:reusableaggregatebusinessinformationentity:3" xmlns:feram="urn:fec:florecom:xml:data:draft:reusableaggregatebusinessinformationentity:7" xmlns:udt="urn:un:unece:uncefact:data:standard:unqualifieddatatype:4" xmlns:qdt="urn:un:unece:uncefact:data:standard:qualifieddatatype:3" xmlns:ccts="urn:un:unece:uncefact:data:standard:corecomponentstechnicalspecification:2" targetnamespace="urn:fec:florecom:xml:data:draft:crossindustryinvoice:10" elementformdefault="qualified" attributeformdefault="unqualified" version="0.10"> <!-- ======================================================================= --> <!-- ===== imports ==== --> <!-- ======================================================================= --> <!-- ===== import of reusable aggregate business information entity schema module ===== --> <!-- ======================================================================= --> <xsd:import namespace="urn:un:unece:uncefact:data:standard:unqualifieddatatype:4" schemalocation="http://www.unece.org/uncefact/data/standard/unqualifieddatatype_4p0.xsd"/> <!-- ======================================================================= --> <!-- ===== import of qualified datatype schema module ===== --> <!-- ======================================================================= --> <xsd:import namespace="urn:un:unece:uncefact:data:standard:qualifieddatatype:3" schemalocation="http://www.unece.org/uncefact/data/standard/qualifieddatatype_3p0.xsd"/> <!-- ======================================================================= --> <!-- ===== import of reusable aggregate business information entity schema module ===== --> <!-- ======================================================================= --> <xsd:import namespace="urn:un:unece:uncefact:data:standard:reusableaggregatebusinessinformationentity:3" schemalocation="http://www.unece.org/uncefact/data/standard/reusableaggregatebusinessinformationentity_3p0.xsd"/> <!-- ======================================================================= --> <!-- ===== import of fec reusable aggregate business information entity schema module ===== --> <!-- ======================================================================= --> <xsd:import namespace="urn:fec:florecom:xml:data:draft:reusableaggregatebusinessinformationentity:7" schemalocation="http://schemas.florecom.org/xml/data/draft/fec_reusableaggregatebusinessinformationentity_7p0.xsd"/> <!-- ======================================================================= --> <!-- ===== element declarations ===== --> <!-- ======================================================================= --> <!-- ===== root element declarations ===== --> <!-- ======================================================================= --> <xsd:element name="crossindustryinvoice" type="feccii:crossindustryinvoicetype"> <xsd:annotation> <xsd:documentation xml:lang="en"> <ccts:uniqueid>unmcii1</ccts:uniqueid> <ccts:acronym>cii</ccts:acronym> <ccts:name>crossindustryinvoice</ccts:name> <ccts:version>1.0</ccts:version> <ccts:definition>the cross industry invoice electronic document exchanged between trading partners prime function request payment. important accounting document , has potential legal implications sender , receiver. used in european union key document vat declaration , reclamation, statistics declaration in respect of intra community trade, , support export , import declaration in respect of trade countries outside european community.</ccts:definition> </xsd:documentation> </xsd:annotation> </xsd:element> <!-- ================================================================== --> <!-- ===== type definitions ===== --> <!-- ================================================================== --> <!-- ===== type definitions: crossindustryinvoicetype ===== --> <!-- ================================================================== --> <xsd:complextype name="crossindustryinvoicetype"> <xsd:sequence> <xsd:element name="supplierparty" type="ram:supplierpartytype" minoccurs="0"/> <xsd:element name="customerparty" type="ram:customerpartytype" minoccurs="0"/> <xsd:element name="buyerparty" type="ram:buyerpartytype" minoccurs="0"/> <xsd:element name="sellerparty" type="ram:sellerpartytype" minoccurs="0"/> <xsd:element name="consignorparty" type="ram:consignorpartytype" minoccurs="0"/> <xsd:element name="consigneeparty" type="ram:consigneepartytype" minoccurs="0"/> <xsd:element name="invoiceeparty" type="ram:invoiceepartytype" minoccurs="0"/> <xsd:element name="invoicerparty" type="feram:invoicerpartytype" minoccurs="0"/> <xsd:element name="manufacturerparty" type="ram:manufacturerpartytype" minoccurs="0"/> <xsd:element name="payeeparty" type="ram:payeepartytype" minoccurs="0"/> <xsd:element name="payerparty" type="feram:payerpartytype" minoccurs="0"/> <xsd:element name="invoiceissuerparty" type="ram:invoiceissuerpartytype" minoccurs="0"/> <xsd:element name="taxrepresentativeparty" type="ram:taxrepresentativepartytype" minoccurs="0"/> <xsd:element name="customeraccountantparty" type="ram:customeraccountantpartytype" minoccurs="0"/> <xsd:element name="supplieraccountantparty" type="ram:supplieraccountantpartytype" minoccurs="0"/> <xsd:element name="clearingagentparty" type="feram:clearingagentpartytype" minoccurs="0"/> <xsd:element name="invoicetradelineitem" type="feram:invoicetradelineitemtype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="billingperiod" type="ram:billingperiodtype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="tradetransportmeans" type="ram:tradetransportmeanstype" minoccurs="0"/> <xsd:element name="tradetransportmode" type="ram:tradetransportmodetype" minoccurs="0"/> <xsd:element name="payableaccountingaccount" type="ram:payableaccountingaccounttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="receivableaccountingaccount" type="ram:receivableaccountingaccounttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="billingcurrencyexchange" type="ram:billingcurrencyexchangetype" minoccurs="0"/> <xsd:element name="paymentcurrencyexchange" type="ram:paymentcurrencyexchangetype" minoccurs="0"/> <xsd:element name="alternativepaymentcurrencyexchange" type="ram:alternativepaymentcurrencyexchangetype" minoccurs="0"/> <xsd:element name="taxcurrencyexchange" type="ram:taxcurrencyexchangetype" minoccurs="0"/> <xsd:element name="payeefinancialaccount" type="ram:payeefinancialaccounttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="tradeallowancecharge" type="ram:tradeallowancechargetype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="billingadjustment" type="ram:billingadjustmenttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="tradenote" type="ram:tradenotetype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="tradedeliveryterms" type="ram:tradedeliverytermstype" minoccurs="0"/> <xsd:element name="billingdocument" type="feram:billingdocumenttype"/> <xsd:element name="billingpayment" type="ram:billingpaymenttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="advancepayment" type="ram:advancepaymenttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="referenceddocument" type="ram:referenceddocumenttype" minoccurs="0" maxoccurs="unbounded"/> <xsd:element name="billingmonetarysummation" type="ram:billingmonetarysummationtype" minoccurs="0"/> <xsd:element name="categorysubtotaltax" type="ram:categorysubtotaltaxtype" minoccurs="0" maxoccurs="unbounded"/> </xsd:sequence> </xsd:complextype> </xsd:schema>
the actual data file unfortunately cannot share, validates. (scrambling break validation.)
i need convenient way extract data these in delphi code.
- i tried xml data binding wizard xsd, not manage spit out compiling code; lots , lots of interfaces simple data type.
- generating xml data file result in compiling code gives simple data types data blank.
- having found problems name spaces adjusted
registerchildnode
,childnodes
calls pass blank string namespace (which when parsing hand). interface casting errors.
is there hope of getting generator work? perhaps structure complicated, , don't need two-way binding. i'm looking readable (map/dictionary-like?) way of extracting data (not dominated particularities of xml). type-safety not must.
it's not delphi-centered question. i'm afraid xsd.exe wouldn't better job .net. perhaps can share experience make job easier
what i'm looking readable (map/dictionary-like?) way of extracting data (not dominated particularities of xml).
you have bit of problem right there. looking map richness of xsd semantics simple dictionary structure intrinsically problematic.
it's not delphi-centered question. i'm afraid xsd.exe wouldn't better job .net. perhaps can share experience make job easier.
two recommendations:
- to understand relationships specified in xsds, roll sleeves , understand xsds rather try map way out of xsds.
to automatically test conditions against xsds, leverage existing tools.
the news xsd xml document , therefore subject parsing plethora of tools in many language can parse xml.
the bad news semantics of xsd complicated enough you'll have rough doing analysis in general simple spot checks in restricted cases.
for processing both xml , xsds, i'd recommend xpath-based queries on other technologies here, if can leverage schema-aware processing xslt 2.0.
Comments
Post a Comment