Category : xml

My current task is to get information from XSD file (type of field, name of field etc). I have XSD file looks like that: <?xml version="1.0" encoding="UTF-8"?> <!– edited with XMLSpy v2018 rel. 2 sp1 (x64) (http://www.altova.com) by test (123321) –> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="attribute"> <xs:annotation> <xs:documentation>Атрибуты ОГХ</xs:documentation> </xs:annotation> <xs:sequence> <xs:element name="owner_id"> <xs:annotation> ..

Read more

im building a site(flask) and making using a payment api but its my first time using api and i have no clue how get the variables from xml Here is the xml that return from request <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="API_Library"> <SOAP-ENV:Body> <ns1:gerarReferenciaMBResponse> <sucesso>true</sucesso> <entidade>82142</entidade> <referencia>000762738</referencia> <valor>5</valor> <estado>0</estado> <resposta>OK</resposta> </ns1:gerarReferenciaMBResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> And my ..

Read more

I have a method ExecuteReport(xs:string sessionId, xs:string reportName, ns1:ArrayOfKeyValueOfstringstring reportParameters, ) I need to pass the variable arguments to reportParameters. For complex arguments, I understand that client.factory.create should provide hints. But this is where I get stuck: factory.create("ns1:ArrayOfKeyValueOfstringstring") doesn’t really provide anything useful. I have tried: parameters = self._soap_client.factory.create("ns1:ArrayOfKeyValueOfstringstring") parameters = [{"p": "9300K"}, {"ps": "08/01/2021:12:00:00"}, ..

Read more

I often use len(find_all("some_element") to count the number of entities in a xml file. I tried to build a function, but it doesn’t work/ it always give me "None". The XML file: <parent> <some> <child>text</child> <child>text</child> <child>text</child> </some> </parent> my python code: def return_len(para1,para2): # doesn’t work if bool(suppe.para1): # the element isn’t always present ..

Read more

I have an XML reader application who reads through thousands of XML files, during the processing I received the following error: xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 62, column 48 After debugging I found out its file_348.xml which is presented in below code. Now I don’t know what’s wrong with this XML file, when I ..

Read more

I have a xml file: ‘product.xml’. <?xml version="1.0"?> <Rowset> <ROW> <Product_ID>32</Product_ID> <Company_ID>2</Company_ID> <User_ID>90</User_ID> <Product_Type>1</Product_Type> <Application_ID>BBC#:1010</Application_ID> </ROW> <ROW> <Product_ID>22</Product_ID> <Company_ID>4</Company_ID> <User_ID>190</User_ID> <Product_Type>2</Product_Type> <Application_ID>NBA#:1111</Application_ID> </ROW> <ROW> <Product_ID>63</Product_ID> <Company_ID>4</Company_ID> <User_ID>99</User_ID> <Product_Type>1</Product_Type> <Application_ID>BBC#:1212</Application_ID> </ROW> <ROW> <Product_ID>22</Product_ID> <Company_ID>2</Company_ID> <User_ID>65</User_ID> <Product_Type>2</Product_Type> <Application_ID>NBA#:2210</Application_ID> </ROW> </Rowset> using this code in Pycharm: import xml.etree.cElementTree as et import pandas as pd def find_tag(row, tag_name): tag ..

Read more

I’m trying to create the XMl. my root element contain namespace like this < test:root xmlns:test1="www.test1.com" xmlns:test2="www.test2.com" xmlns:test3="www.test3.com"> to achieve above one i tried this import xml.etree.elementtree as Xml test1= "www.test1.com" test2= "www.test2.com" test3= "www.test3.com" Xml.register_namespace(‘test1’, test1) Xml.register_namespace(‘test2’, test2) Xml.register_namespace(‘test3’, test3) name1 = Xml.QName(test1,"1") name2 = Xml.QName(test2,"2") name3 = Xml.QName(test3,"3") rootele = Xml.Element("test:root",{name1:"",name2:"",name3:"",name4:""}) print(Xml.tostring(rootele).decode()) above ..

Read more

Python reads all lines <ns1: Status> Registered </ ns1: Status> It is necessary to count only in tags <ns1: CmDevices> <ns1: item> no deeper. The correct value should be 2 not 4. bad result How to do it? Original xml: <ns1:CmNodes> <ns1:item> <ns1:ReturnCode>Ok</ns1:ReturnCode> <ns1:Name>sgo-uc-ccm11.go.rshbank.ru</ns1:Name> <ns1:NoChange>false</ns1:NoChange> <ns1:CmDevices> <ns1:item> <ns1:Status>Registered</ns1:Status> <ns1:StatusReason>0</ns1:StatusReason> <ns1:TimeStamp>1633964311</ns1:TimeStamp> <ns1:Protocol>SIP</ns1:Protocol> <ns1:NumOfLines>1</ns1:NumOfLines> <ns1:LinesStatus> <ns1:item> <ns1:DirectoryNumber>7414658</ns1:DirectoryNumber> ..

Read more

Follow the model I want But I’m sending in this format the response.My reponse is grouping by the return tag. I wanted to have the parent element return and the other elements as a son. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://ws.integracaoresultados.spdata.com.br/"> <soap:Body> <tns:enviarResponse> <retorno> <examesComErro> <id>3149700</id> <motivo>(‘fdb:’, DatabaseError(‘Error while executing SQL statement:n- SQLCODE: -803n- attempt to store duplicate ..

Read more