EDN Admin
Well-known member
Hi,
I have a xml file containing Japanese characters. Validation fails with a error "the value cannot be used with this data type in the element" when validating the xml file. For some japanese characters it passes for some characters it fails. I guess for characters
like hiragana , katakana characters it fails.
For eg: my xml file looks as below:
<system-name>気気持ち</system-name><br/>
<description></description><br/>
</application-properties>
...<column><br/>
<column-name>きー1</column-name><br/>
<column-id>PYHIS244UERHCEEPBQJAENNKEM.GYHIS244UERHCEEPBQJAENNKEM</column-id><br/>
<type>varchar</type>
for the system name node "気気持ち"it passes , but it fails for "きー1" column node.
Could any help me in validating hirakana characters in xml. I also tried using
xml version = "1.0" encoding="UTF-8", xml version = "1.0" encoding="UTF-16". But it fails.
when i tried to use xml version = "1.0" encoding="SHIFT-JIS" am getting different error like
""."hexadecimal-value-0x00-invalid-character-line-2-position-1"
i have a code to validate as below:
public bool Validate(string xmlSource)<br/>
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.CheckCharacters = false;<br/>
XmlReader reader = XmlReader.Create(new StringReader (xmlSource),settings);<br/>
return validate(reader);<br/>
}<br/>
<br/>
<br/>
private bool validate(XmlReader reader)<br/>
{<br/>
try<br/>
{<br/>
XmlValidatingReader validator = new XmlValidatingReader(reader);<br/>
<br/>
//setup a resolver to call back<br/>
validator.XmlResolver = schemaResolver;<br/>
//reset resolved flag<br/>
schemaResolver.Resolved = false;<br/>
while (validator.Read()) ;<br/>
reader.Close();<br/>
//return true if no exception and the schema is resolved<br/>
// otherwise false;<br/>
valid = schemaResolver.Resolved;<br/>
}
Please help me in resolving the issue.
View the full article
I have a xml file containing Japanese characters. Validation fails with a error "the value cannot be used with this data type in the element" when validating the xml file. For some japanese characters it passes for some characters it fails. I guess for characters
like hiragana , katakana characters it fails.
For eg: my xml file looks as below:
<system-name>気気持ち</system-name><br/>
<description></description><br/>
</application-properties>
...<column><br/>
<column-name>きー1</column-name><br/>
<column-id>PYHIS244UERHCEEPBQJAENNKEM.GYHIS244UERHCEEPBQJAENNKEM</column-id><br/>
<type>varchar</type>
for the system name node "気気持ち"it passes , but it fails for "きー1" column node.
Could any help me in validating hirakana characters in xml. I also tried using
xml version = "1.0" encoding="UTF-8", xml version = "1.0" encoding="UTF-16". But it fails.
when i tried to use xml version = "1.0" encoding="SHIFT-JIS" am getting different error like
""."hexadecimal-value-0x00-invalid-character-line-2-position-1"
i have a code to validate as below:
public bool Validate(string xmlSource)<br/>
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.CheckCharacters = false;<br/>
XmlReader reader = XmlReader.Create(new StringReader (xmlSource),settings);<br/>
return validate(reader);<br/>
}<br/>
<br/>
<br/>
private bool validate(XmlReader reader)<br/>
{<br/>
try<br/>
{<br/>
XmlValidatingReader validator = new XmlValidatingReader(reader);<br/>
<br/>
//setup a resolver to call back<br/>
validator.XmlResolver = schemaResolver;<br/>
//reset resolved flag<br/>
schemaResolver.Resolved = false;<br/>
while (validator.Read()) ;<br/>
reader.Close();<br/>
//return true if no exception and the schema is resolved<br/>
// otherwise false;<br/>
valid = schemaResolver.Resolved;<br/>
}
Please help me in resolving the issue.
View the full article