XML Validation using XSD
-
I have a tool called "Flat file to XML converter" to convert the text file information to XML file using the XSD template available. Text file contains employee details. Whenever a name with apostrphe(') comes the tool converts it as ' instead of '. So whenever the XML file is decoded to view, it is showing the name with '. Please help me in this. To make any changes in the tool is not possible and no XSLT is available for the XML file. Only XSD is there. I need to validate this ' and replace it with ' Is it possible? Only a change in XSD is allowed. No seperate application/tool to convert the XML is allowed. Example:- flat fle contains the name- O'NEIL, JOHN. XML file after conversion - O 'NEIL, JOHN. Output needed - O'NEIL, JOHN
-
I have a tool called "Flat file to XML converter" to convert the text file information to XML file using the XSD template available. Text file contains employee details. Whenever a name with apostrphe(') comes the tool converts it as ' instead of '. So whenever the XML file is decoded to view, it is showing the name with '. Please help me in this. To make any changes in the tool is not possible and no XSLT is available for the XML file. Only XSD is there. I need to validate this ' and replace it with ' Is it possible? Only a change in XSD is allowed. No seperate application/tool to convert the XML is allowed. Example:- flat fle contains the name- O'NEIL, JOHN. XML file after conversion - O 'NEIL, JOHN. Output needed - O'NEIL, JOHN
Validation DOES NOT alter the input XML - it just tells you if it meets the Schema or not. Why does it matter, anyway? Any conforming XML reader will convert the ' entity to an apostrophe when it reads it!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Validation DOES NOT alter the input XML - it just tells you if it meets the Schema or not. Why does it matter, anyway? Any conforming XML reader will convert the ' entity to an apostrophe when it reads it!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
But whenever a name with apostrophe comes the "flat file to XML" converter convert it to ' So the XML parser can't change it to apostrophe when it process it. What do i do to avoid it?
The XML parser will interpret the ' as an apostrophe and store it as such internally. The apostrophe is only converted to ' when written to the XML file. The XML Standard[^] says that the apostrophe may be stored as ' to permit use in attribute values. By always translating an apostrophe to ' you make sure the apostrophe is always in a readable form.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
But whenever a name with apostrophe comes the "flat file to XML" converter convert it to ' So the XML parser can't change it to apostrophe when it process it. What do i do to avoid it?
-
sorry friend, i meant whenever a name with apostrophe comes the "flat file to XML converter" converts it to
&";apos
instead of'
(please omit the double quotes). So the XML parser can't parse it to &apos.Sounds like either the flat-files coming with entity encoding already done, or the converters doing the encoding twice. You can't fix that once you're in the XML domain - the original text might have been
'
!Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p