|
Re: Leading whitespace is not removed when parsing list element [message #1207478 is a reply to message #1207169] |
Sun, 24 November 2013 11:03   |
Eclipse User |
|
|
|
Jan,
Please open a bugzilla.
On 24/11/2013 1:26 PM, Jan Schoubo wrote:
> Hi,
>
> I believe there is still a problem with parsing list elements - leading whitespace is not skipped.
>
> This problem is very similar to http://www.eclipse.org/forums/index.php?t=msg&goto=846629
> and the resulting bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=376967 .
>
> The solution was to change pattern used in the EFactoryImpl method split method
> from "[ \t\n\r\f]" to "[ \t\n\r\f]+" - however, Pattern.split will return a leading
> empty String, if the pattern is found in the beginning of the target string,
> so the solution is not quite adequate?
>
> Please see example below, and the enclosed Eclipse project.
>
> I have validated the XSD/XML successfully at http://www.freeformatter.com/xml-validator-xsd.html
>
> EMF is 2.9.1.v20130902-0605 and Eclipse is 4.3.1.M20130911-1000, under Linux Mint 14 (64 bit).
>
> - Jan
>
>
> XSD:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://www.example.org/testmodel/" targetNamespace="http://www.example.org/testmodel/">
>
> <xs:simpleType name="ListOfFloats">
> <xs:list itemType="xs:float" />
> </xs:simpleType>
>
> <xs:simpleType name="float2x2">
> <xs:restriction base="ListOfFloats">
> <xs:minLength value="4" />
> <xs:maxLength value="4" />
> </xs:restriction>
> </xs:simpleType>
>
> <xs:element name="matrix">
> <xs:complexType>
> <xs:simpleContent>
> <xs:extension base="float2x2">
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
>
> <xs:element name="root">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="matrix" minOccurs="1" maxOccurs="unbounded" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> </xs:schema>
>
>
> XML - first and second matrix is ok, third and fourth fails validation:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root
> xmlns="http://www.example.org/testmodel/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.example.org/testmodel/ ../../model/testmodel.xsd ">
>
> <matrix>1.0 0.0 0.0 1.0</matrix>
>
> <matrix>1.1 0.1
> 0.1 1.1
> </matrix>
>
> <matrix> 1.2 0.2
> 0.2 1.2
> </matrix>
>
> <matrix>
> 1.3 0.3
> 0.3 1.3
> </matrix>
> </root>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.06037 seconds