magento2 – How to customize the page through the XML section of Design Update on a CMS page?

You do not need to use the initial tags (for example, page and body), you can remove the Compare products and the wishlist from the sidebar and add your custom CMS block through this snippet below:


             
                
                    contact_information
                
            


 


        
        

python – read the XML file using and store in sql postgrey

I am writing the code, but it is not changing the data to sql postgrey … here is my code. I am new to Python. seeking expert help
import psycopg2
import xml.etree.ElementTree as et
def main ():

conn = psycopg2.connect("dbname= 'postgres' user ='postgres' password= '****'")
cur = conn.cursor()

cursor = conn.cursor()
tree = et.parse("original.xml")
root = tree.getroot()

for row in root.findall("MM_LESJE"):
    p = (row.find(n).text for n in ("id", "TOVARNISKA_STEVILKA", "NAZIV_VRSTE_ODJEMA"))

    insert_query = ('INSERT INTO book(id, TOVARNISKA_STEVILKA, NAZIV_VRSTE_ODJEMA VALUES (%s, %s, %s), p')

    cursor.execute(p, insert_query)
    cursor.commit()

Yes first name == "principal":
principal()

powershell – SharePoint Online Add cross-site search with PnP and XML

I am trying to set up a cross-site search field using XML (what I could do in previous local SharePoint environments). However, I have some difficulty creating a similar configuration in my tenant-based environment of SharePoint Online.

My destination settings have the following details:

  1. Two (modern) team sites, both at the same site level, and both associated with a
    Team site (hub).
  2. SiteA has a list of projects / products.
  3. SiteB has a list of records that contain a search field that should point to the list of projects in SiteA.

Right now, I'm just trying to create a site column in SiteB that will be a search field that points to the List of projects in SiteA. As I know that this configuration cannot be done in the OOB user interface, I am using the PowerShell 5.1 commands and the PnP library cmdlets to do it through XML. When I run the lines below, a site column is created on site B, but it doesn't really seem to be connected to the project list (site A), so there are no values ​​when I use it to create a column in a list. I have also tried to directly create a column in a list (to see if that would work better).

For the XML below, I am specifying the GUID of the list in SiteB that contains the list of projects and the GUID of the web context for SiteB. I am using NewGuild to generate a new GUID for the new site column.

Some samples of my PS code:

$newguid = (GUID)::NewGuid()

$fieldXML = ''

Add-PnPFieldFromXml -FieldXml $fieldXML

One thing that I have noticed (and that has intrigued me) is that when I use Get-PnPWeb to get (what I think it is) the WebID, the returned GUID is exactly the same for SiteA and SiteB. I have used separate PowerShell consoles to extract information from sites separately to make sure that the commands work in the correct sites. So, I wonder if I am using the correct GUID in my XML (for WebId) to point to the Web (or site) that contains the list of projects.

I will continue to try things, but I hope someone can have some suggestions or ideas on how to configure XML for SharePoint Online and establish successful cross-site search.

UPDATE to the original question

I have continued working on this topic. I had been working with two Team sites that are associated with a Hub site. But then I decided to try to work with two different Team sites, not associated with any Hub sites. In this case, the WebID (LookupWebIDs) were different from each other. Then, I reconfigured my XML and used Add-PnPFieldFromXML that created a new Site column (without errors), and the property values ​​for the new column were checked out as desired.

$fieldXML = ‘’

Add-PnPFieldFromXML -fieldXML $FieldXML (to create the new Test Column on Site A)

*Check properties*
PS C:> $testCol.LookupList
{9e887b1f-12ad-4feb-a1f8-a9fe5d15b6ab}
PS C:> $testCol.LookupWebID

Guid
----
8ff42b00-5858-4f6d-8295-80aff7950373

But when I tried to use the new column in a list, the drop-down menu has no values ​​(it should be 3 values), so it still doesn't seem to connect correctly to the list elsewhere.

UPDATE 2: A possible solution
———————————–

Finally I was able to obtain the ability between sites using PowerShell / GUID / XML to set the SchemaXML property of a search field in my list (SiteB) to point to the list of values ​​(SiteA). The GUIDs for List, WebID and SourceID were set to values ​​between sites and everything worked as expected. However, I first had to create a collection of classic sites (in my online tenant) to be able to create two team sites with the classic SharePoint team site template.

No matter what I tried, I couldn't get the inter-site capability to work with a Modern Team Site template. For me, it only seems to work on sites created with the Classic template. It is still important to find a solution that allows the ability to search between sites using modern settings, so this problem has not yet been resolved. I just wanted to share what worked, in case it helps someone else.

python: iterating on xml child elements, and their child elements, and their child elements, etc. no nested loops

I wrote a program that reads and processes xml files sent by external users. The part of the code in question iterates over the children of the xml node, adds a dictionary, a future row in a table, and repeats the process for each child and their child, and so on.

The exemplary xml node looks like this:

xmlstr =  '1065106.46675706.310.0023750.000.000.001041356.46675706.310.000.000.000.00466158.9359838.400.000.000.000.000.000.000.000.000.000.000.000.000.001065106.46675706.310.00556001.19138410.820.0050000.0050000.000.00509105.27537295.490.000.000.000.000.000.000.00

Code I've written (get ready, it's pretty ugly):

# code to help you get started
from lxml import etree
tree = etree.fromstring(xmlstr)
tree.xpath('.')(0).getchildren()
xml_node = tree.xpath('.')(0)

# real use case starts here
table = ()
tmp = {}
for b in xml_node:
    lvl = 0
    tag = b.tag
    txt = b.text

    table.append(tmp)
    tmp = {}
    tmp('lbl') = tag
    tmp('lvl') = lvl

    for elem in b.getchildren():
        lvl = 1
        tag = elem.tag
        txt = elem.text
        if tag.lower().strip().startswith('foo'):
            tmp(tag) = txt
        else:
            table.append(tmp)
            tmp = {}
            tmp('lbl') = tag
            tmp('lvl') = lvl

        for el in elem.getchildren():
            lvl = 2
            tag = el.tag
            txt = el.text
            if tag.lower().strip().startswith('foo'):
                tmp(tag) = txt
            else:
                table.append(tmp)
                tmp = {}
                tmp('lbl') = tag
                tmp('lvl') = lvl

            for e in el.getchildren():
                lvl = 3
                tag = e.tag
                txt = e.text
                if tag.lower().strip().startswith('foo'):
                    tmp(tag) = txt
                else:
                    table.append(tmp)
                    tmp = {}
                    tmp('lbl') = tag
                    tmp('lvl') = lvl

                for e in e.getchildren():
                    lvl = 4
                    tag = e.tag
                    txt = e.text
                    if tag.lower().strip().startswith('foo'):
                        tmp(tag) = txt
                    else:
                        table.append(tmp)
                        tmp = {}
                        tmp('lbl') = tag
                        tmp('lvl') = lvl

                    for e in e.getchildren():
                        lvl = 5
                        tag = e.tag
                        txt = e.text
                        if tag.lower().strip().startswith('foo'):
                            tmp(tag) = txt
                        else:
                            table.append(tmp)
                            tmp = {}
                            tmp('lbl') = tag
                            tmp('lvl') = lvl

                        for e in e.getchildren():
                            lvl = 6
                            tag = e.tag
                            txt = e.text
                            if tag.lower().strip().startswith('foo'):
                                tmp(tag) = txt
                            else:
                                table.append(tmp)
                                tmp = {}
                                tmp('lbl') = tag
                                tmp('lvl') = lvl

                            for e in e.getchildren():
                                lvl = 7
                                tag = e.tag
                                txt = e.text
                                if tag.lower().strip().startswith('foo'):
                                    tmp(tag) = txt
                                else:
                                    table.append(tmp)
                                    tmp = {}
                                    tmp('lbl') = tag
                                    tmp('lvl') = lvl


                                if e.getchildren():
                                   raise NotImplementedError

# make_sure_last_row_is_appended
try:
    if table(-1)('lbl') != tag:
        table.append(tmp)
except KeyError:
    # probably table has only 1 row
    table.append(tmp)

# remove_technical_first_row
p = table.pop(0)

The output looks like this (as it should, there is no room for maneuver with respect to its structure):

( {'lbl': 'Level1', 'lvl': 0, 'Foo_A': '1065106.46', 'Foo_B': '675706.31', 'Foo_B1': '0.00'}, {'lbl': 'Level1_A', 'lvl': 1, 'Foo_A': '23750.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level1_B', 'lvl': 1, 'Foo_A': '1041356.46', 'Foo_B': '675706.31', 'Foo_B1': '0.00'}, {'lbl': 'Level1_B_1', 'lvl': 2, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level1_B_2', 'lvl': 2, 'Foo_A': '466158.93', 'Foo_B': '59838.40', 'Foo_B1': '0.00'}, {'lbl': 'Level1_B_2_1', 'lvl': 3, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level1_B_2_2', 'lvl': 3, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level1_C', 'lvl': 1, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level1_D', 'lvl': 1, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level2', 'lvl': 0, 'Foo_A': '1065106.46', 'Foo_B': '675706.31', 'Foo_B1': '0.00'}, {'lbl': 'Level2_A', 'lvl': 1, 'Foo_A': '556001.19', 'Foo_B': '138410.82', 'Foo_B1': '0.00'}, {'lbl': 'Level2_A_1', 'lvl': 2, 'Foo_A': '50000.00', 'Foo_B': '50000.00', 'Foo_B1': '0.00'}, {'lbl': 'Level2_B', 'lvl': 1, 'Foo_A': '509105.27', 'Foo_B': '537295.49', 'Foo_B1': '0.00'}, {'lbl': 'Level2_B_1', 'lvl': 2, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'}, {'lbl': 'Level2_B_2', 'lvl': 2, 'Foo_A': '0.00', 'Foo_B': '0.00', 'Foo_B1': '0.00'})

The main problem with this code is that I have no control over the input xml, so, in theory, it can be more nested than I will anticipate in my code. So far I wrote & # 39; n & # 39; + 3 for-loops with & # 39; n & # 39; as the maximum level of nesting observed in a test sample, but an xml entry can easily be more nested than & # 39; n & # 39; + 3.

What I wrote was justified in part by being in a hurry, but to be honest, I have no idea how to handle this more elegantly. I reviewed the methods proposed in several articles (for example, this or that), but I couldn't think of anything. Maybe this can be done with the statement & # 39; while True … break & # 39; or the getchildren () method hidden in a generator function …

Also, it is important to maintain the data structure, so the lxml._Element.iter () method instead of lxml._Element.getchildren () seems like a bad idea.

Until now, performance was not a problem.
In the last stage of the refactoring process, I generally improve the names of variables and divide the code into the smallest possible functions with descriptive names according to the "Clean Code" methodology, so suggestions in this area, although welcome, They are secondary to the main problem.

How can I improve my code?

How to create a 32 million page XML sitemap for the HTML website [on hold]

I have created an HTML website with 32 crore pages. This is a flight booking website. Now I want to create an xml site map for this and implement

postgresql – ERROR: invalid XML content, when Select unnest (xpath (… in a text column

I have a column of text called big_xml in my table that has the following value:



 
  PADPIDA2006111001O
  234AG
  
Riedtlistrasse 23, Zürich, 8006, CH
PADPIDA2007011501Q OpenIMP
8-10 Rhoda Street, London, E2 7EF, UK
PADPIDA2007040501K The Harry Fox Agency
711 Third Avenue, 8th Floor, New York, 10017, USA

Execute the request:

SELECT 
  unnest((xpath('/dpid:DpidDatabase/DpidOwner',  table1.big_xml::xml,ARRAY(ARRAY('dpid', 'http://ddex.net/xml/dpid/11'))))) AS SequenceNumber   
  ,unnest((xpath('/dpid:DpidDatabase/DpidOwner/DPID',  table1.big_xml::xml,ARRAY(ARRAY('dpid', 'http://ddex.net/xml/dpid/11'))))) AS DPID
  ,unnest((xpath('/dpid:DpidDatabase/DpidOwner/CompanyName',  table1.big_xml::xml,ARRAY(ARRAY('dpid', 'http://ddex.net/xml/dpid/11'))))) AS CompanyName 
  ,unnest((xpath('/dpid:DpidDatabase/DpidOwner/Address',  table1.big_xml::xml,ARRAY(ARRAY('dpid', 'http://ddex.net/xml/dpid/11'))))) AS Address
FROM table1_20190828

Error shown:

ERROR: invalid XML content
 Detail: line 1: XML declaration allowed only at the start of the document

        ^
1 statement failed.

layout – Magento 2: Validation message in XML

I want to edit the validation message in some input fields. I see that the input fields are defined in the xml file (checkout_index_index.xml). Is there any way to cancel the validation message in this xml?


  
    0
  

Remove additional characters from the XML code with python or PowerShell

I have many XML files saved in a structure like the following.

#$Dummy$#
--- Other tags & Elements ---

Notice the characters #$Dummy$# at first. This is inserted on purpose, to protect the intruders who analyze and read the data. Apart from this, the rest of the data is purely xml. And the files are saved with .xml extension. I know how to analyze xml with Element Tree.

In this case Element Tree throw the following error

ParseError: not well-formed (invalid token): line 1, column 2

Currently, we open the files with any text editor and manually delete the characters. How can I delete this code with Python or Power Shell. since there are thousands of files to analyze.

Open XML SDK in Visual Basic 6

Is this library compatible with Visual Basic 6? How could I add the reference to that library?

sql server: how to load XML child nodes in multiple tables

I would like to load the following XML in 2 tables

Table 1: Account table: you must have ACCT_NUM and a key to link to table 2 below

Table 2: You must have all contacts (1 record per Contact_Type) and must be able to link back to Table 1

Here is my XML:




111111



800.123.4444
PO Box 11111


800.123.5555
PO Box 22222




222222



888.123.6666
PO Box 33333


888.123.7777
PO Box 44444




Any help is really appreciated.