XPATH selecting the root element

An XPath expression starting with / is always referring to the root element. Look here for the syntax and some useful sample queries If you want to select the root element itself, simply use /<element name> or /*

JAXB Marshalling Unmarshalling with CDATA

You could do the following: AdapterCDATA package forum14193944; import javax.xml.bind.annotation.adapters.XmlAdapter; public class AdapterCDATA extends XmlAdapter<String, String> { @Override public String marshal(String arg0) throws Exception { return “<![CDATA[” + arg0 + “]]>”; } @Override public String unmarshal(String arg0) throws Exception { return arg0; } } Root The @XmlJavaTypeAdapter annotation is used to specify that the XmlAdapter … Read more

Why does getRealPath() return null when deployed with a .war file? [duplicate]

For a start, ServletRequest.getRealPath(String path) is deprecated. The appropriate replacement is: ServletContext context = session.getServletContext(); String realContextPath = context.getRealPath(request.getContextPath()); However, the API docs for ServletContext.getRealPath(String path) state: “This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made … Read more

Marshalling LocalDate using JAXB

You will have to create an XmlAdapter like this: public class LocalDateAdapter extends XmlAdapter<String, LocalDate> { public LocalDate unmarshal(String v) throws Exception { return LocalDate.parse(v); } public String marshal(LocalDate v) throws Exception { return v.toString(); } } And annotate your field using @XmlJavaTypeAdapter(value = LocalDateAdapter.class) See also javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters if you want to define your adapters … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)