0

as i don't want to insert 300 Products with many data in an online form i want to build a tool to build the xml-file for a bulk-import. By now i only did some stuff with flask and databases and some little things with xml but THIS xml-file with these many namespaces is far over my actual knowledge. So, now to my main-problem.... how can i add those many namespaces in the first 2 rows?

Thanks for your help.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:ProductModelRegistrationRequest xmlns:ns2="http://eprel.ener.ec.europa.eu/productModel/productCore/v2" xmlns:ns3="http://eprel.ener.ec.europa.eu/services/productModelService/modelRegistrationService/v2" REQUEST_ID="TestSupplier984833555867785">
    <productOperation OPERATION_ID="myOp984833569318831" OPERATION_TYPE="PREREGISTER_PRODUCT_MODEL">
        <MODEL_VERSION >
            <MODEL_IDENTIFIER>LP XX0</MODEL_IDENTIFIER>
            <SUPPLIER_NAME_OR_TRADEMARK>Supplier name or trademark</SUPPLIER_NAME_OR_TRADEMARK>
            <DELEGATED_ACT>EU_874_2012</DELEGATED_ACT>
            <ENERGY_LABEL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns6="http://eprel.ener.ec.europa.eu/commonTypes/EnergyLabelTypes/v2" xsi:type="ns6:GeneratedEnergyLabel">
                <CONSIDER_GENERATED_LABEL_AS_PROVIDED>true</CONSIDER_GENERATED_LABEL_AS_PROVIDED>
            </ENERGY_LABEL>         
            <ON_MARKET_START_DATE>2018-04-25+02:00</ON_MARKET_START_DATE>
            <TECHNICAL_DOCUMENTATION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:TechnicalDocumentationDetail">
                <DOCUMENT>
                    <ns2:DESCRIPTION>test conditions</ns2:DESCRIPTION>
                    <LANGUAGE>FR</LANGUAGE>
                    <TECHNICAL_PART>CALCULATIONS</>
                    <TECHNICAL_PART>GENERAL_DESCRIPTION<TECHNICAL_PART/TECHNICAL_PART>
                    <TECHNICAL_PART>MESURED_TECHNICAL_PARAMETERS</TECHNICAL_PART>
                    <TECHNICAL_PART>REFERENCES_TO_HARMONISED_STANDARDS</TECHNICAL_PART>
                    <TECHNICAL_PART>SPECIFIC_PRECAUTIONS</TECHNICAL_PART>
                    <TECHNICAL_PART>TESTING_CONDITIONS</TECHNICAL_PART>
                    
                    <FILE_PATH>/attachments/testConditions.docx</FILE_PATH>
                </DOCUMENT>
            </TECHNICAL_DOCUMENTATION>
            <CONTACT_DETAILS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:ModelSpecificContactDetails">
                <CONTACT_NAME>Lamp Contact name</CONTACT_NAME>
                <ADDRESS xmlns:ns5="http://eprel.ener.ec.europa.eu/commonTypes/baseTypes/v1" xsi:type="ns5:SingleFieldAddress">
                    <ADDRESS>My address</ADDRESS>
                </ADDRESS>
                <PHONE_NUMBER>123-444-477-441</PHONE_NUMBER>
                <EMAIL_ADDRESS>test@test.fr</EMAIL_ADDRESS>
            </CONTACT_DETAILS>
            <PRODUCT_GROUP_DETAIL xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns5="http://eprel.ener.ec.europa.eu/productModel/productGroups/lamp/v2" xsi:type="ns5:Lamp">
                <ENERGY_CLASS>A+</ENERGY_CLASS>
                <WEIGHTED_ENERGY_CONS>1</WEIGHTED_ENERGY_CONS>
            </PRODUCT_GROUP_DETAIL>
        </MODEL_VERSION>
    </productOperation>
</ns3:ProductModelRegistrationRequest>
  • Does [this](https://stackoverflow.com/questions/14853243/parsing-xml-with-namespace-in-python-via-elementtree) answer your question? – DerMaddi Feb 25 '21 at 14:53
  • Thanks for your answer... after reading the article in your answer and some other articles i come to the conclusion... this is to much for me. I start now to weite this xml fiel "By hand" and if this didn't work. I will finster These bis Hand in the Web Frontend... i think this will be faster than learning to handle this with xml –  Feb 25 '21 at 17:40

0 Answers0