Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XML Validation using XSD

XML Validation using XSD

Scheduled Pinned Locked Moved XML / XSL
xmlhelptutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scrapper
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • S scrapper

      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

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • S Stuart Dootson

        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

        S Offline
        S Offline
        scrapper
        wrote on last edited by
        #3

        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?

        S S 2 Replies Last reply
        0
        • S scrapper

          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?

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • S scrapper

            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?

            S Offline
            S Offline
            scrapper
            wrote on last edited by
            #5

            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.

            S 1 Reply Last reply
            0
            • S scrapper

              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.

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups