잘못된 공백이 포함 된 XML 인스턴스의 유효성 검사를 거부하는 작동하는 xsd가 있습니다 (자세한 내용은 아래 참조). 캐리지 리턴 (#xD), 줄 바꿈 (#xA) 또는 탭 (# x9) 또는 끝나는 공백 (# x20) 문자 또는 두 개 이상의 인접한 공백 문자 시퀀스).리터럴 대 변형 된 새 줄의 XML 스키마 유효성 검사?
샘플 XSD는 :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://www.example.com"
xmlns:test="http://www.example.com">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
<xs:element name="test-token" type="test:Tokenized500Type"></xs:element>
<xs:simpleType name="Tokenized500Type">
<xs:annotation>
<xs:documentation>An element of this type has minimum length of one character, a max of 500, and may not
contain any of: the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, shall
not begin or end with a space (#x20) character, or a sequence of two or more adjacent space
characters.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:maxLength value="500"/>
<xs:minLength value="1"/>
<xs:pattern value="\S+(\S+)*"/>
</xs:restriction>
</xs:simpleType>
나는 위와 같이 문자 공백 문자로이 테스트.
XML 인스턴스에 관련 요소 콘텐츠에 이스케이프 처리 된 공백이 있으면 어떻게됩니까? 이로 인해 유효성 검사 오류가 발생하거나되지 않습니까?
<?xml version="1.0" encoding="UTF-8"?>
<test-token xmlns="http://www.example.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com"> </test-token>
도 참조 : XS의
의미 : 토큰 XSD 프로세서 : Will an instance with a xsd:token-type element containing whitespace pass validation?
XSD 제한 수 있도록 여기에
는 탈출 버전으로 예를 들어 인스턴스의 xs : 토큰 공백 만 : What is the regular expression for the set of strings that validate exactly the same for xsd:token and xsd:string?
XSD 및 샘플 XML을 제공하고 어떤 오류가 발생했는지/예상 할 수 있습니까? – Sprotty
감사합니다. 추가했습니다. 은 리터럴 nl처럼이 스키마의 인스턴스를 무효화하는 것처럼 보이기 때문에 원하는 경우가 아니면 내 질문에 대답합니다. – Michael