I'm trying to select a node by its attribute name, but my selectors return nothing.
XML
<?xml version="1.0" encoding="utf-8"?>
<products>
<product ID="10036218">
<name>TEST</name>
<price currency="EUR">8.95</price>
<categories>
<category path="Feestartikelen">Feestartikelen</category>
</categories>
<properties>
<property name="fromPrice">
<value>8.95</value>
</property>
<property name="gender">
<value></value>
</property>
<property name="deliveryCosts">
<value>3.95</value>
</property>
<property name="model">
<value>Balloons</value>
</property>
</properties>
<variations/>
</product>
</products>
Dim nodeList As XmlNodeList = root.SelectNodes("/products/product")
nodelist.Count = 530 here, so I'm getting results.
Next I tried both properties/property/#model/value and properties/property/#model as values to select the node. Both return nothing.
For Each node In nodeList
If node.SelectSingleNode("properties/property/#model/value") IsNot Nothing Then
End If
Next node
What's wrong with my expressions?
This should get you the node by attribute name:
For Each node In nodeList
If node.SelectSingleNode("properties/property[#name='model']/value") IsNot Nothing Then
End If
Next node
Related
I have Multiple Custom content types, and based on individual type i am able to query documents. But my requirement is i want to get all types of document.
I wrote query select * from hr:hrdoctype, Because my hr:hrdoctype is my parent type for all other types. But its not working.
But if i will write select * from hr:hrReimbursment, This is working fine.
So how can i get all All Custom types of documents with single parent type or with single condition.
Please see the Below configuration.
in this case if i will use specific content type then its working fine. but i want to get all type of document using single query.
Please help me how can i write CMIS Query for this requirement.
Share-config-custom.xml:-
<type name="cm:content">
<subtype name="hr:hrdoctype" />
</type>
<type name="hr:hrdoctype">
<subtype name="hr:hrReimbursment" />
<subtype name="hr:hrMISCELLANEOUS" />
<subtype name="hr:hrWELFARE_POLICIES" />
<subtype name="hr:hrGENERAL_POLICIES" />
<subtype name="hr:hrPOLICIES_SIGNOFF_NOTES_FILE_NOTES" />
<subtype name="hr:hrPHOTOGRAPH" />
<subtype name="hr:hrPIF_PROFILE_OVERVIEW" />
<subtype name="hr:hrMPR_FORM" />
<subtype name="hr:hrPSYOMETRIC_REPORT" />
<subtype name="hr:hrTECHNICAL_TEST_ASSESSEMENT" />
<subtype name="hr:hrINTERVIEW_ASSESSEMENT_SHEET" />
</type>
Custom-content-model.xml:-
<types>
<type name="hr:hrdoctype">
<title>HR Document</title>
<parent>cm:content</parent>
<properties>
<property name="hr:employeeNumber">
<title>Employee Number</title>
<type>d:text</type>
</property>
<property name="hr:employeeName">
<title>Employee Name</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="hr:hrReimbursment">
<title>REIMBURSEMENT</title>
<parent>hr:hrdoctype</parent>
<properties>
<property name="hr:DocumentDescription">
<title>Document Description</title>
<type>d:text</type>
</property>
<property name="hr:ReimbursmentDate">
<title>Reimbursment Date</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="hr:hrMISCELLANEOUS">
<title>MISCELLANEOUS</title>
<parent>hr:hrdoctype</parent>
<properties>
<property name="hr:DocumentDescription1">
<title>Document Description</title>
<type>d:text</type>
</property>
</properties>
</type>
</types>
I just tested simillar case on my repository.
There are four base CMIS types: cmis:document, cmis:folder, cmis:relationship, cmis:policy. Types cmis:document and cmis:folder must be supported by any repository.
I my case the myc:xyz type inherits from the cmis:folder type.
CMIS query selecting all folders:
select * from cmis:folder where cmis:name='ABCD'
returns folder:
{
"cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
"cmis:objectTypeId": "F:myc:xyz",
"cmis:baseTypeId": "cmis:folder",
"cmis:name": "ABCD"
}
CMIS query selecting all myc:xyz folders:
select * from myc:xyz where cmis:name='ABCD'
return the same folder with some myc:xyz type's additional properties:
{
"cmis:objectId": "5b97929c-553b-4494-91cc-2c18e50b2f1c",
"cmis:objectTypeId": "F:myc:xyz",
"cmis:baseTypeId": "cmis:folder",
"cmis:name": "ABCD",
"myc:AdditionalProperty1": "1111",
"myc:AdditionalProperty2": "2222"
}
Hope this helps.
OpenCMIS Client API Developer's Guide
PS. You can test queries with Alfresco CMIS 1.1 "The Browser binding".
For example, this is URL for the query select * from cmis:folder where cmis:name='ABCD' (Firefox automatically decoding encoded parameters in URL, it is very comfortable):
http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/?cmisselector=query&succinct=true&q=select * from cmis:folder where cmis:name='ABCD'
I have the following xml
<?xml version="1.0" encoding="UTF-8"?>
<tests>
<testdef name="Gaps (Simple)">
<property GapInterval="null" />
<property ReturnAllOpt="null" />
</testdef>
<testdef name="Gaps (Holiday Aware)">
<property GapInterval="null" />
<property HolidayOrigin="null" />
<property ReturnAllOpt="null" />
</testdef>
I need to get the attributes of property for each of the testdef name.
List<string> values = new List<string>();
XmlNodeList valueslist = propdoc.GetElementsByTagName("testdef");
for (int i = 0; i < valueslist.Count; i++)
{
values.Add(valueslist[i].InnerXml);
Console.WriteLine(valueslist[i].InnerXml);
}
I have written the following code where I get the whole attribute of the testdef. Is there any way I can achieve my goal.
My project use spring mvc and hibernate validator .And I am trying to make it support multi-language.
This is my spring-i18N file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">
<mvc:interceptors>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"/>
</bean>
</mvc:interceptors>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieMaxAge" value="604800"/>
<property name="defaultLocale" value="zh_CN" />
<property name="cookieName" value="language"></property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:i18N/messages</value>
<value>classpath:i18N/validation</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8" />
<property name="useCodeAsDefaultMessage" value="false"/>
</bean>
<mvc:annotation-driven validator="validator" />
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
<property name="validationMessageSource" ref="messageSource"/>
</bean>
</beans>
And my problem is,while I use annotations in bean file,like this,
#Size(min=6, max=25,message="{password_length_require}")
private String password;
and in the validation_en_US.properties,I do this
password_length_require=The password length require more than 5 and less 25
The result is that page will output "{password_length_require} ".
On the other hand,in my controller,I use
bindingResult.rejectValue("password", "password_length_require");
It will work fine...
Can anybody help me?
I had the same problem before,it took me long time to solve it.
Just like me,there might be something wrong with the following configuration.
<property name="basenames">
<list>
<value>classpath:i18N/messages</value>
<value>classpath:i18N/validation</value>
</list>
</property>
The value of property "basenames" must be full path where your validation messages files save in your project.For example,if validation message files are in package named "org.example.config.i18N.messages", you should config the xml like this:
<value>classpath:org/example/config/i18N/messages</value>
So maybe you need to check whether or not your configuration is right.
The above is my experience, hope to help you.
Using Alfresco 4.2 or 5.0, how do you disable full text indexing on a content-model basis?
Here is an example content model, what do you change specifically (i.e. do not reference the index control aspect without how to actually use it with a content model).
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
FINAL ANSWER
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>my:doNotIndexContentControl</aspect>
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
</aspects>
</model>
Important Note: If you get "Source node class has no callback" errors, this is related to changing the content model and then trying to update (likely versionable) existing content. No known workaround, but this is unrelated to index control options.
You can achieve this by defining a new aspect that extends cm:indexControl like so:
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
Note the overrides. The overridden property, cm:isContentIndexed, with default value set to false is key.
You then add this aspect as mandatory for the types which you do not wish to full text index the content. The full configuration options for cm:indexControl can be found in the documentation http://docs.alfresco.com/4.2/concepts/admin-indexes.html
Also, if you have existing content items that have already been indexed and you want those documents to no longer be indexed, you will need to do a full re-index.
This is covered in the Data Dictionary guide on the Alfresco wiki
All you need to do is all this to your model:
<index enabled="false" />
If you look at something like the Alfresco system model, you'll see several examples of that
I would like my Spring Webflow app to render its views using XSLT. I managed to get a pure Spring MVC app to render with xslt by configuring an XSLTviewresolver and a controller method that returned an already prepared xml as a source.
But I'm not sure how to apply that to the webflow app.
I've added the configuration for the XSLT view resolver and set the view state to the xsl, then I call the controller method that returns the xml source in the on-render of the view state.So far I only get the xsl back as the output and not the transformed xml or even the raw xml.
EDIT
flow.xml-full
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
<view-state id="messageChoice" view="start1">
<transition on="chooseA" to="messageA"/>
<transition on="chooseB" to="messageB"/>
</view-state>
<view-state id="messageA" view="messageA">
<transition on="start" to="messageChoice"/>
</view-state>
<view-state id="messageB" view="xsltview">
<on-render>
<evaluate expression="sampleController.viewXSLT(externalContext.getNativeRequest(),externalContext.getNativeResponse())" result="requestScope.xmlSource"/>
</on-render>
<transition on="start" to="messageChoice"/>
</view-state>
<end-state id="finish"/>
</flow>
controller-snippet
#RequestMapping(value="/viewxslt")
public ModelAndView viewXSLT(HttpServletRequest request,
HttpServletResponse response) throws IOException {
// builds absolute path of the XML file
String xmlFile = "/WEB-INF/xml/thexml.xml";
String contextPath = request.getSession().getServletContext().getRealPath(xmlFile);
String xmlFilePath = ""+contextPath + File.separator + xmlFile;
Source source = new StreamSource(new File(contextPath));
// adds the XML source file to the model so the XsltView can detect
ModelAndView model = new ModelAndView("xsltview");
model.addObject("xmlSource", source);
return model;
}
EDIT
flow-config-full
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
<context:annotation-config />
<context:component-scan base-package="com.genkey.derek" />
<mvc:view-controller path="/start" />
<mvc:view-controller path="/messageHome" />
<mvc:resources location="/" mapping="/resources/**" />
<faces:resources />
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="3" />
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean id="xsltviewresolver" class="org.springframework.web.servlet.view.xslt.XsltViewResolver">
<property name="order" value="1"/>
<property name="sourceKey" value="xmlSource"/>
<property name="viewClass" value="org.springframework.web.servlet.view.xslt.XsltView"/>
<property name="viewNames">
<array>
<value>xsltview</value>
</array>
</property>
<property name="prefix" value="/WEB-INF/xsl/" />
<property name="suffix" value=".xsl" />
</bean>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref bean="xsltviewresolver"/>
<ref bean="faceletsViewResolver" />
</list>
</property>
</bean>
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".xhtml" />
<property name="order">
<value>2</value>
</property>
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-executor id="flowExecutor">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" >
<webflow:flow-location path="WEB-INF/flows/startFlow.xml"/>
</webflow:flow-registry>
<faces:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" development="true" />
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>
</beans>