Multiple URL pattern elements in web.xml - eclipse

Is it OK to have multiple elements in the element in a J2EE web app version 2.4 compliant web.xml like this:
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>*.htm</url-pattern>
<url-pattern>*.do</url-pattern>
</filter-mapping>
I looked up the XSD "web-app_2_4.xsd" file from here : http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
and the definition looks like this:
<xsd:complexType name="filter-mappingType">
<xsd:annotation>
<xsd:documentation>
some documentation here
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="filter-name"
type="j2ee:filter-nameType"/>
<xsd:choice>
<xsd:element name="url-pattern"
type="j2ee:url-patternType"/>
<xsd:element name="servlet-name"
type="j2ee:servlet-nameType"/>
</xsd:choice>
<xsd:element name="dispatcher"
type="j2ee:dispatcherType"
minOccurs="0" maxOccurs="4"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
</xsd:complexType>
The URL pattern definition looks like this:
So I think, we can have multiple elements in the element.
My Eclipse IDE however does not seem to agree with me, and expects a 'dispatcher' tag.
See image:

Clearly no, but you can have:
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

Default is 1 for maxOccurs and minOccurs in sequence element: https://msdn.microsoft.com/en-us/library/ms256089(v=vs.110).aspx.
And choice allows only one of the elements of it:
https://msdn.microsoft.com/en-us/library/ms256109(v=vs.110).aspx

Related

Referenced file contains error at Liberty server.xml file

I am receiving the following error at server.xml file liberty server. I couldn't solve this problem.
Referenced file contains errors (file:/D:/workspaces/myprojects/.metadata/.plugins/com.ibm.ws.st.core/Liberty Runtime/server.xsd). For more information, right click on the message in the Problems View and
select "Show Details..."
**My server.xsd file **
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ext="http://www.ibm.com/xmlns/dde/schema/annotation/ext">
<xsd:complexType name="com.ibm.ws.app.manager.webappcfg">
<xsd:annotation>
<xsd:documentation>Defines the properties of a web application.</xsd:documentation>
<xsd:appinfo>
<ext:label>Web Application</ext:label>
</xsd:appinfo>
</xsd:annotation>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="startAfter" type="com.ibm.ws.app.manager-factory">
<xsd:annotation>
<xsd:documentation>Specifies applications that are required to start before this application can begin starting. </xsd:documentation>
<xsd:appinfo>
<ext:label>Start After</ext:label>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="classloader" type="com.ibm.ws.classloading.classloader">
.
.
.
I want to get rid of this error.
Error Details:
enter image description here

XSD for receiving PDF files in Oracle Service Bus

I am trying to write a service for Oracle Service Bus 12C to receive a PDF file.
The external service has two parameters of the format:
http://server.domain.com/documents?docId=12345&fetch=summary|document
If the parameter 'fetch' is sent with the value 'summary', it returns the summary information in JSON format. If the parameter value is 'document', it returns the PDF file with the Content-Type set as 'application/pdf'.
For the JSON response, the XSD is simple:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://TargetNamespace.com/DocServices_getFile_response"
targetNamespace="http://TargetNamespace.com/DocServices_getFile_response"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
elementFormDefault="qualified"
nxsd:version="JSON" nxsd:encoding="US-ASCII">
<xsd:element name="File-Proxy-Response-Root-Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="docCode" type="xsd:integer"/>
<xsd:element name="docDescription" type="xsd:string"/>
<...snip...>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:annotation xmlns="">
<xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
<xsd:appinfo>USEHEADER=false</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
But I can't figure out how to support receiving PDF response.

Spring Batch job description missing in the JobBuilderFactory

In the Spring Batch job XML configuration there was the possibility to add a job description
<xsd:element name="job">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="description" type="description" minOccurs="0"/>
...
</xsd:sequence>
</xsd:element>
Questions:
Why is this not possible anymore in the Java configuration?
Spring Batch Admin has a column called Description, but it doesn't show anything.
As far as I can tell from the source code of both Spring Batch and Admin this is never stored/retrieved from the job repository. What is the reason behind it?

XSD restrictions are not working at all on jboss eap 6.1

Here is my XSD
<element name="FirstName" minOccurs="1" maxOccurs="1" >
<simpleType>
<restriction base="string">
<length value="5"></length>
</restriction>
</simpleType>
</element>
when post a request through SOAP UI, not validating that restriction at all. I am not sure what's wrong in my code

IPhone-XPath query wont retrieve my node

I'm using GData as my XML parser.
I've tried using an XPath query to retrieve a node -
#"//GetPlacesAutoCompleteResult".
but getNodesForXPath doesn't return any nodes.
so I'm asking, what's wrong with the query I typed in?
P.S
I'm only looking for a way to find out if the node exists or not, I care not about it's child nodes.
here is my .xml file (a result from a soap query to an .ASMX Web-Service).
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetPlacesAutoCompleteResponse
xmlns="http://xxxxxxx.com/xxxxxx/webservice">
<GetPlacesAutoCompleteResult>
<xs:schema id="NewDataSet"
xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet"
msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0"
maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ID"
type="xs:long"
minOccurs="0"/>
<xs:element name="FullName"
type="xs:string"
minOccurs="0"/>
<xs:element name="PlaceTypeID"
type="xs:int"
minOccurs="0"/>
</xs:sequence>
</xs:complexType></xs:element>
</xs:choice>
</xs:complexType></xs:element>
</xs:schema>
<diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<ID>47393</ID>
<FullName>Yifat</FullName>
<PlaceTypeID>10</PlaceTypeID>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1">
<ID>48497</ID>
<FullName>Haifa</FullName>
<PlaceTypeID>10</PlaceTypeID>
</Table>
<Table diffgr:id="Table3" msdata:rowOrder="2">
<ID>70827</ID>
<FullName
>Haifa - Central Bus Rishon</FullName>
<PlaceTypeID>120</PlaceTypeID>
</Table>
</NewDataSet>
</diffgr:diffgram>
</GetPlacesAutoCompleteResult>
</GetPlacesAutoCompleteResponse>
</soap:Body>
</soap:Envelope>
Well with <GetPlacesAutoCompleteResponse xmlns="http://xxxxxxx.com/xxxxxx/webservice"><GetPlacesAutoCompleteResult> you have a default namespace declaration in scope so assuming you use XPath 1.0 you need to bind a prefix to the namespace URI http://xxxxxxx.com/xxxxxx/webservice and use that prefix to qualify element names. For example if the prefix is ws then you would use //ws:GetPlacesAutoCompleteResult.
How you bind a prefix to a namespace URI depends on the XPath API you use, I am not familiar with GData so I can't help you with a code sample.