two quick questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tascienu@ecoaches.com

    two quick questions

    1 - Can an element have some innerText as well as child nodes?
    ie: <myel>some inner text here... <subel/></myel>
    is it allowed?

    2 - I have a file element... <file src="/Images/spacer.gif" />. I want
    to select it...
    myfile.selectSi ngleNode(File[@src='/Images/spacer.gif'])

    the problem is, on windows, file names can be any case...
    /IMAGES/SPACER.GIF would also be valid, but it would not select that
    node. How do i deal with this?

    Thanks...

  • Richard Tobin

    #2
    Re: two quick questions

    In article <1110742595.507 854.20170@z14g2 000cwz.googlegr oups.com>,
    <tascienu@ecoac hes.com> wrote:
    [color=blue]
    >1 - Can an element have some innerText as well as child nodes?
    >ie: <myel>some inner text here... <subel/></myel>
    >is it allowed?[/color]

    "innerText" suggests that you are using some system I'm not familiar
    with, but as far as XML is concerned you can certainly mix text and
    elements. Just think of (X)HTML: <p>Some <b>bold</b> text.</p>
    [color=blue]
    >2 - I have a file element... <file src="/Images/spacer.gif" />. I want
    >to select it...
    >myfile.selectS ingleNode(File[@src='/Images/spacer.gif'])
    >
    >the problem is, on windows, file names can be any case...
    >/IMAGES/SPACER.GIF would also be valid, but it would not select that
    >node. How do i deal with this?[/color]

    Well, I'd start by not using Windows, but you might also find the
    translate() function useful:

    File[translate(@src, "ABCDEFGHIJKLMN OPQRSTUVWXYZ",
    "abcdefghijklmn opqrstuvwxyz") = '/images/spacer.gif']

    This will not of course work for non-English characters, but you don't
    seem to have any of them.

    -- Richard

    Comment

    Working...