python package json2xml remove wrapper not working - json

How to remove wrapper completely :
https://pypi.org/project/json2xml/
there is option to change but not remove
print(json2xml.Json2xml(data, wrapper="all", pretty=True).to_xml())
tried the wrapper arguments with blank
print(json2xml.Json2xml(data, wrapper=" ", pretty=True).to_xml())
its throwing error
raise InvalidDataError
json2xml.utils.InvalidDataError

Related

unable to find multiple existing element with selenium

here is the html code of the Links i am trying to click on (i dont know why selenium cant locate the link. My guess is, that there are X amounts of the link. The only difference is the string in the brackets of onclick.) Underneath i'll show you 2 examples of the html code. I'd like to click on all of them (in this case on both)!
Button or Link:
<td class="text-right">
Ansehen</td>
Button or Link:
<td class="text-right">
Ansehen</td>
here are my Attempts to click on the button:
driver.find_element_by_link_text("doRetrievePnr('DUA75J')").click()
driver.find_element_by_xpath("//a[#onclick='doRetrievePnr('DUA75J')']").click()
Here are the Errors i get:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"link text","selector":"doRetrievePnr('DUA75J')"}
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //a[#onclick='doRetrievePnr('DUA75J')'] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//a[#onclick='doRetrievePnr('DUA75J')']' is not a valid XPath expression.
am I missing out on something?
EDIT
Heres a picture of the BUTTONS, the HTML CODE and my PYTHON CODE (lines 34 & 35)
As mentioned in the comments - getting all the items of a specific identifier can be done with find_elements_by_... (note find elements - it's plural)
That returns an array you can iterate through to interact with each element.
It looks like all your links have the same ID.
Something like this might work:
links = driver.find_elements_by_id('viewPnr')
for link in links:
link.click()
time.sleep(10) #replace this with what you want to do
Obviously if you're clicking links and the page changes this might not work after the first iteration. However, this is the concept on how you can get all objects and iterate through them.

MIXIN_WITHOUT_BODY - pug mixins

I am new to Pug! been trying to create a simple mixin for nav-item and also am using Gulp 4 for compiling with Gulp-pug package! It keeps on showing error 'PUG:MIXIN_WITHOUT_BODY' I googled it but nothing. Tell what's wrong in it? is it a syntax error ?
mixin nav-item(name, link)
li.nav-item
a.nav-link(href=link)= name
The content of mixins must be indented one level beneath the line that starts with "mixin". Otherwise the mixin declaration is empty.
Write your mixin declaration like this instead:
mixin nav-item(name, link)
li.nav-item
a.nav-link(href=link)= name

Polymer paper-card failed to construct CustomElement

I've got an application that seems to work fine when I put all my elements inside a <dom-bind> element. When I remove that dom-bind (no longer needed), most of the elements carry on working, but paper-card stops and throws an error:
"Uncaught DOMException: Failed to construct 'CustomElement': The result must not have attributes"
The error is thrown from polymer/lib/legacy/lib/class.html if that helps. Anyone got any ideas?
I had the same error, and find out angular create an empty element (), then bind stuffs to it.
This fail according to spec:
4.13.2 Requirements for custom element constructors
The element must not gain any attributes or children
https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance
I fix my problem by assigning in connectedCallback()

Polymer remove parent

When trying to remove a the parent element I have been able to use this line for most cases:
Polymer.dom(Polymer.dom(this).node.domHost.parentNode).removeChild(Polymer.dom(this).node.domHost);
Yet in some cases I get this error:
Uncaught Error: The node to be removed is not a child of this node: [object HTMLElement]
I have verified the child is there and the objects look correct, but I think I am probably missing a Polymer.dom() somewhere?
I have been able to solve it for all cases that I need by doing this:
var thisNode = Polymer.dom(this).node;
Polymer.dom(Polymer.dom(thisNode.domHost).parentNode).removeChild(thisNode.domHost);

Can I call a class name that has a space at the end of it?

I am trying to call the class for the following:
class="content_list_link "
I dont have the option to correct the actual source of this and need to be able to style that class.
I have tried to just call it as .content_list_link and as a.content_list_link as it is in an a tag.
Any input on this would be appreciated.
Problem solved by: Can I call a class name that has a space at the end of it?
Yes, spaces just separate classes.
That means you can style using:
.content_list_link { }
As that's what is seen as the name of the class.
It could be such that class='content_list_link otherClass', and then you'll see how you can style either, or both. If you're having trouble applying the style, then the problem lies elsewhere.