What is the difference between DOCUMENT_NODE, DOCUMENT_TYPE_NODE and DOCUMENT_FRAGMENT_NODE? - xerces-c

Can any one explain to me what is the difference between:
DOCUMENT_NODE
DOCUMENT_TYPE_NODE
DOCUMENT_FRAGMENT_NODE
in Xerces-C.

A DOCUMENT_FRAGMENT_NODE can be used as a top level parent of a partial document. For example to implement a cut-copy-paste operation. Described in detail here: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-B63ED1A3
A DOCUMENT_TYPE_NODE is the starting node of a DTD declaration starting with <!DOCTYPE.
Also described in detail here: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-412266927
The DOCUMENT_NODE is the root node of the node tree generated from the XML input. Please note that this is not the root element of the XML instance. The parse() method returns a pointer to a DOCUMENT_NODE from where you can access the complete XML. Detailed description can be found here: http://xerces.apache.org/xerces-c/apiDocs-3/classDOMDocument.html

Related

Trying to Get child node(Switch ) from Parent(LinearLayout) via AndroidFindby(resourceid), Appium

(class=android.widget.LinearLayout,resource-id=settings_language_selection_toggle,index=1 )
(class=android.widget.RelativeLayout,index=0)
(class=android.widget.LinearLayout,resource-id=widget_frame, index=1)
(class=android.widget.Switch,resource-id=switchWidget, index=0)
/////////////
You can have a look at the hierarchical representation of the elements below
Hierarchy Image View:
***I have tried to reach the switch button by writing the below code on appium Android for java, but it did not work
#AndroidFindBy(xpath ="new UiSelector().resourceId(\"com.idscan.mjcs.sample:id/settings_language_selection_toggle\").instance(1).getChildById(new UiSelector().className(\"android.widget.Switch\")
You using UiSelector syntax in XPath strategy. That is why it isn't working. Try this one:
#AndroidFindBy(uiAutomator = "resourceId(\"settings_language_selection_toggle\").childSelector(className(\"android.widget.Switch\"))")
As you can see here, some boilerplate can be omitted, e.g. new UiSelector().resourceId(...) can be simplified to resourceId(...). One more thing: once you found the root element (LinearLayout with the given resourceId), you can find any child element in the hierarchy using .childSelector() method, nesting doesn't matter.

How to convert View<doc> or Async<doc> to Doc in webSharper?

Please, I am new to WebSharper does anyone know how I can convert View (doc) or Async (doc) to Doc in webSharper? I have tried to open "WebSharper.UI.Next.Client" but does not seem to be compatible with the Doc I am using. The code giving such error is the one I found on the WebSharper website https://try.websharper.com/snippet/adam.granicz/00003b
On the conversions: the functions are Doc.EmbedView and Doc.Async respectively.
The problem with the references was that WebSharper.UI has another separate version still called on its earlier name WebSharper.UI.Next for back-compatibility in older projects. It is recommended to use WebSharper.UI only.
The snippet you have linked was not updated accordingly, I have done it now, and will check others too. The main differences are that Next is no longer used in the namespace names and default HTML combinators take attribute and children lists both (An empty div is now div [] [] while previously there it was a div [] or divAttr [] []).

XQuery and XPath - testing for child/attribute based on current attribute

I have numerous xml files structured
<seg type="dep_event" xml:id="MS609-0000-01">
<date type="event_date" when="1245"/>
</seg>
Where <date type="event_date" when="1245"> is optional.
Now in Xpath/Xquery 3.1, I need test for the existence of date#when, based on the current context node seg/#xml:id.
Imagine this situation in Xquery 3.1:
let $doc := doc(somedocument.xml)
for $xmlidattr in $doc//tei:seg[#type="dep_event"]/#xml:id
Now, I need to test date/#when using $xmlidattr
Many thanks in advance.
EDIT: restructured question to be more clear about the idea of context node in XQuery
The parent of the id is the seg, its child is the date:
../date[#type="event_date"][#when="1245"]
That was the answer to the original question. The question has changed and the new answer is
$xmlidattr/../date[#type="event_date"][#when="1245"]
However, I would normally start from the containing element rather than from the attribute:
for $seg in $doc//tei:seg[#type="dep_event"],
$xmlidattr in $seg/#xml:id
return f($seg/date[#type="event_date"][#when="1245"])

Tomcat Startup exception: Failed to read schema document

This is idp.war deployment on tomcat 7(.69)
Failed to read schema document 'class path:/schema/shibboleth-2.0-services.xsd'
in the trace it suggests some things:
1) could not find the document.
2) the document could not be read.
3) the root element of the document is not <xsd:schema>
I can go into the deployment: idp/WEB-INF/lib/shibboleth-common-1.2.1.jar/schema/ and see all the shibboleth-2.0- .xsd files that the Service.xml file is declaring as schemaLocations
this folder was created by tomcat deployment for tomcat so I don't know why it can't be read, I'm guessing permissions issues wouldn't apply here.
and the root element of the .xsd document is
<schema ... >
so that qualifies as
<xsd:schema>
correct or no?
Two points:
(1) Whether a start-tag with the element-type name schema is effectively the same as one with the element-type name xsd:schema depends on the namespace bindings, which are omitted here. (The start-tag <xsd:schema> cannot occur as the first tag in a namespace-well-formed XML document, so I'm assuming you're paraphrasing, not quoting.)
If the unprefixed schema start-tag makes "http://www.w3.org/2001/XMLSchema" the default namespace, then that is not likely to be your problem. (Hint for the next time you ask a question, though: omitting salient information like namespace bindings makes your question less clear and less likely to get useful responses.)
(2) The error message you quote puts a blank between the strings 'class' and 'path' -- if your reference to the schema document actually does begin "class path:", then that is your problem: Shibboleth's documentation says:
Shibboleth defines a special URL scheme, classpath, which ensures that the schema files are resolved from the classpath.
As a matter of URI syntax, blanks are not allowed in the middle of a scheme name. You will need to start any URI you want to identify in this way with "classpath:/", not "class path:/".

Correct Xpath -

I have a xml like -
<?xml version="1.0" encoding="UTF-8"?>
<oslc_cm:Collection xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
oslc_cm:totalCount="7"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/">
<rtc_cm:Action rdf:resource="https://rtc.gsissc.myatos.net:9443/ccm/oslc/workflows/_ezLt4PJ7EeGRg6GNKwqw9g/actions/com.ibm.team.workitem.defectWorkflow/com.ibm.team.workitem.defectWorkflow.action.resolve">
<dc:identifier>com.ibm.team.workitem.defectWorkflow.action.resolve</dc:identifier>
<rtc_cm:resultState rdf:resource="https://rtc.gsissc.myatos.net:9443/ccm/oslc/workflows/_ezLt4PJ7EeGRg6GNKwqw9g/states/com.ibm.team.workitem.defectWorkflow/3"/>
<dc:title>Resolve</dc:title>
<rtc_cm:iconUrl>https://rtc.gsissc.myatos.net:9443/ccm/service/com.ibm.team.workitem.common.internal.model.IImageContentService/processattachment/_ezLt4PJ7EeGRg6GNKwqw9g/workflow/resolve.gif</rtc_cm:iconUrl>
</rtc_cm:Action>
From it I have to fetch rtc_cm:resultState rdf:resource.
What would be the correct XPath for it. I am using XPathExpression xPathExpressionDescription = xpath.compile("../rtc_cm:resultState/#rdf:resource"); which is giving me null pointer.
Please guide me .
../rtc_cm:resultState/#rdf:resource
That's assuming the context node – the node to which your XPath expression is relative – is a sibling of rtc_cm:resultState.
You might be better with an absolute path, based on the document root. Something like:
/oslc_cm:Collection/rtc_cm:Action/rtc_cm:resultState/#rdf:resource
(and, of course, assuming you are passing an implementation of IXmlNamespaceResolver set up with all the applicable namespaces).
The absolute path would be:
/oslc_cm:Collection/rtc_cm:Action/rtc_cm:resultState/#rdf:resource
If you know there is only one instance of resultState or if you want to query for all instances:
//rtc_cm:resultState/#rdf:resource
Please make sure that your namespace manager has definitions for the namespaces you use in your XPath expression.

Resources