Child element namespace overridden by the root element namespace in JIBX - jibx

I am getting below exception at runtime while unmarshalling response xml using jibx.
My root level binding has the namespace as 'abc.com/' but the child element tag has
different namespace as xyz.com. During unmarshalling root level mapping element namespace is overridden for the child element namespace.
below is the definition I added in the binding xml for the element tag.
<value style="element" name="ipName" get-method="getIpName" set-method="setIpName" ns="https://xyz.coms" />
Exception:
org.jibx.runtime.JiBXException: Expected "{abc.com/}ipName" start tag, found "{xyz.com/}ipName"

I am bale to resolve this error. Here I got the answer
http://marc.info/?l=jibx-users&m=122091431913533&q=raw.
Just added separate mapping for the child element.

Related

where to get list of all bindable properties for angular http elements?

MDN says:
If you want default content for your , you enter it between the opening and closing tags. does not support the value attribute.
but in angular property binding we can bind to value.
<textarea rows="10" [value]="'test'" ></textarea>
is there any online repository where we can find all the properties with regard to angular.??
I found the article "HTML Attributes vs DOM Properties and Angular 2 Data Binding" useful, especially the following sections:
DOM is basically collection of objects (window,html,body, head and etc) which allows us to manipulate it. It means that HTML elements are contained in the DOM as objects.HTML elements have attributes which initilizes DOM properties. Once initilization process is done attributes job is done.
<input type=”text” value=”5">
Given input element has type and value attributes. When HTML element is created its properties which have similar names to attributes (but not same thing) is created, too. After initilization given input element have properties such as type and value.
Angular property binding acts on the elements/objects contained in the DOM. You can find a list of properties of all element interfaces at MDN Web APIs documentation. Most of the one's you're interested in, have a name that starts with 'HTML'.
The HTMLTextAreaElement interface for example corresponds to the <textarea> element. You can use all its properties and the properties of its parent interfaces for Angular property binding as long as they're not read only.

get ViewModel variable to Html Component

I want to load set a class for a HTML componenet <h:li /> like this :
<h:li class="#load(vm.className)" />
but I can't and I can't use a ZK componenent.
Any suggestion will be welcome, Thank you
EDIT
here's the error :
org.zkoss.zel.ELException: The identifier [class] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.zkoss.zel.impl.parser.SKIP_IDENTIFIER_CHECK to true.
That's because "class" is a Java keyword (i.e. you cannot use it as a name). So zk uses "sclass" instead to work around this.
So, try this: <h:li sclass="#load(vm.className)" />
To help understand what is going on: If you write something like <component property="something" /> in zul, zk will at some point call component.setProperty(something). So in your case, even without "class" being a Java keyword, it would have complained that there is no setClass method on li.
If you have trouble setting a property in the future, just open the Java class of the component you are trying to create and check whether it actually has a setter for the property.
Edit after feedback from Op:
#KiloBatata There is another possibility, though: Use the xhtml
namspace instead of the native one. I have just tried it :
<h:li xmlns:h="http://www.w3.org/1999/xhtml" sclass="#load(vm.className)" />
gives me
<li id="z_3" class="hello-world"></li>
Using the xhtml namespace instead of the native one helped, as the native one does not create any widget or components for the DOM elements.

Why isn't there a "class" prop for React?

In React.DOM.Props from purescript-react, DOM node attributes are nearly exhaustively listed there, except for a class attribute (I'd suspect it to be named _class, similar to _type for Purescript's syntax issue). I tried to make my own with
_class :: String -> Props
_class = unsafeMkProps "class"
And attempted to use it, but after inspecting the HTML, React didn't include the attribute! Why is this? Why can't I use a class attribute in my DOM nodes?
You probably want to use className here and not class. This is done to prevent confusion between a JavaScript class and the DOM attribute class.
Here's what the official documentation says:
To specify a CSS class, use the className attribute. This applies to all regular DOM and SVG elements like <div>, <a>, and others.
It is actually even listed in the page you're linking to, here
className :: String -> Props

property "getter object (DOMString name);" in the Document IDL

HTML 5.1 Specification define strange property in the Document IDL.
getter object (DOMString name);
It's not a typo and I don't understand how to use it.
That part of the WebIDL definition for the Document interface specifies that it has a named property getter. It only has meaning in combination with the section of the spec of the HTML spec that defines the supported property names for the Document interface.
Together, those specify some things that get exposed as named properties of a Document.
Consider the following document:
<!doctype html>
<form name=foo></form>
<form name=bar></form>
<iframe name=bar></iframe>
<p id=baz>
If you call document.foo you’ll get back a single element, the form name=foo element.
If you call document.bar you’ll get back a collection that includes both the form name=bar element and iframe name=bar element.
And if you call document.baz you’ll get back undefined.
The reason for all that behavior is, the section of the HTML spec defining the supported property names for the Document interface specifies that form[name] values and iframe[name] values are accessible as named properties of a Document
And that spec section also says that if a Document named property matches only one element, then that element is returned, but if it matches multiple elements, then a collection is returned.
And the reason document.baz returns undefined is because that spec section does not specify p[id] values as being accessible as named properties of a Document.
However, if you instead do window.baz you will get back the p id=baz element.
The reason for that difference is: while the WebIDL definition for Window specifies it is having a named property getter (just as the Document WebIDL does), the section defining the supported property names for Window—unlike the similar section for Document—does specify p[id] values (actually id values of any element) as being accessible as named properties of a Window.

Using Nokogiri to parse HTML with xhtml:link tag?

I am using Nokogiri gem to parse HTML data.
$ gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.6.2.1)
Sample HTML is:
<html>
<body>
<xhtml:link>
<div>
Some content.
</div>
</xhtml:link>
</body>
</html>
I am getting
>> doc.xpath('/html/body/xhtml:link/div')
Nokogiri::XML::XPath::SyntaxError: Undefined namespace prefix: /html/body/xhtml:link/div
from /var/lib/gems/1.9.1/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node.rb:159:in `evaluate'
from /var/lib/gems/1.9.1/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node.rb:159:in `block in xpath'
from /var/lib/gems/1.9.1/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node.rb:150:in `map'
from /var/lib/gems/1.9.1/gems/nokogiri-1.6.2.1/lib/nokogiri/xml/node.rb:150:in `xpath'
from (irb):95
from /usr/bin/irb:12:in `<main>'
A full sample live HTML page can be found here
How can I avoid this error?
You need to add the XML Namespace (xhtml in your example) to your root element so that Nokogiri recognizes it, unless you do that Nokogiri will ignore it and that error will appear.
You can do it this way:
<html xmlns:xhtml="http://www.w3.org/1999/xhtml">
<body>
<xhtml:link>
<div>Some content.</div>
</xhtml:link>
</body>
</html>
See also this and this answers.
UPDATE based on comment
I've reviewed Nokogiri docs and found two workarounds, one is to pass the namespaces:
doc.xpath('/html/body/xhtml:link/div', 'xhtml' => 'http://www.w3.org/1999/xhtml')
Another is to manually add that namespace to the root document:
doc.root.add_namespace 'xhtml', 'http://www.w3.org/1999/xhtml'
doc.xpath('/html/body/xhtml:link/div')
While both ways do silent the error, the query in both cases just returns an empty array for me, unlike what happens if the xmlns attribute was originally included in the document.
You can ignore namespaces, if you are sure there are no unprefixed elements with the same name in the same context. Namespaces affect element and attribute names. If you select them using node(), or * you can test for the local-name() in a predicate without having to deal with namespaces.
In your example, you can select the xhtml:link element by selecting all elements in the context of body, and then restricting the result set to only those which have a local-name equal to link:
doc.xpath('/html/body/*[local-name()="link"]/div')
You might select unwanted HTML <link> elements if they occur in the body (they should never be there, but HTML parsers don't care if they are). But if they occur, they should be empty elements. There will never be one with a <div> inside, so you're safe.