XSL Extracting Ampersand from XSD

Discussion in 'XML' started by james.eaton@gmail.com, Oct 19, 2006.

  1. Guest

    I have an XML Schema Document (.xsd) that contains documentation tags
    (specifically, custom tags subordinate xsd:appinfo). These
    documentation tags contain strings that may contain ampersands. I have
    written an XSL Document (.xls) to extract these values and output an
    XML document including them on the screen. When I copy and paste the
    result to an XML file (.xml) and test for well-formedness, I get an
    error telling me that a semicolon (;) is required after the text that
    follows the ampersand. This is because the parser is expecting an
    escape code. Is there a way to extract this information and translate
    the ampersand to & so that the resulting .xml document will be well
    formed? I have tried using translate($var, '&', '&amp') but it just
    balks at the first ampersand.
     
    , Oct 19, 2006
    #1
    1. Advertising

  2. wrote:
    > documentation tags contain strings that may contain ampersands


    If there's an ampersand in your input document which is used for
    anything other than an entity reference or a character reference, and is
    not within a <[CDATA[]]> section, the document is not legal XML.

    Convert the ampersands to &amp; *BEFORE* asking XML tools to process
    this data. (I'm of the opinion that <[CDATA[]]> causes more problems
    than it solves, and should be used only as a lazy man's solution when
    hand-editing XML.)

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 19, 2006
    #2
    1. Advertising

  3. Guest

    My understanding is that, within appinfo tags, any information is
    considered extraneous data not processed by the XML processor. Hence,
    why it is allowed to be in the source document and still be valid.

    However, your point still stands. If it is not valid in the context of
    the processable portion of an XML document, I suppose the XML parsing
    tools can not be expected to handle it.


    Joseph Kesselman wrote:
    > wrote:
    > > documentation tags contain strings that may contain ampersands

    >
    > If there's an ampersand in your input document which is used for
    > anything other than an entity reference or a character reference, and is
    > not within a <[CDATA[]]> section, the document is not legal XML.
    >
    > Convert the ampersands to &amp; *BEFORE* asking XML tools to process
    > this data. (I'm of the opinion that <[CDATA[]]> causes more problems
    > than it solves, and should be used only as a lazy man's solution when
    > hand-editing XML.)
    >
    > --
    > Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    , Oct 19, 2006
    #3
  4. wrote:
    > My understanding is that, within appinfo tags, any information is
    > considered extraneous data not processed by the XML processor. Hence,
    > why it is allowed to be in the source document and still be valid.


    Validity is only tested after well-formedness is stested -- and an
    isolated & is not well formed XML.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 19, 2006
    #4
  5. wrote:
    > My understanding is that, within appinfo tags, any information is
    > considered extraneous data not processed by the XML processor. Hence,
    > why it is allowed to be in the source document and still be valid.


    Validity is only tested after well-formedness is tested -- and an
    isolated & character is not well formed XML.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 19, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,186
    Markus
    Nov 22, 2005
  2. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    530
    C. M. Sperberg-McQueen
    Sep 26, 2003
  3. Replies:
    1
    Views:
    910
    Martin Honnen
    Jan 14, 2004
  4. Replies:
    1
    Views:
    3,686
    A. Bolmarcich
    May 27, 2005
  5. mike

    Extracting XSD data from WSDL file

    mike, Apr 26, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    790
Loading...

Share This Page