Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12520 closed bug (notabug)

CANNOT FIND ELEMENTS OF NODES IN XML

Reported by: no Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hi, i try to find some data in my xml file. i would like to find test:company

This is the XML:

<Datei>
  <test:company>
    <Headline>1. first headline</Headline>
    <Content>1. first text</Content>
    <Footer>1. first footer</Footer>
  </test:company>
  <test:company>
    <Headline>2. second headline</Headline>
    <Content>2. second text</Content>
    <Footer>2. second footer</Footer>
  </test:company>
</Datei>

The code:

$(xml).find('[nodeName=test:company]').each(function(){
//Do something
})

i also tested:

$(xml).find('test\\\\:company, company').each(function(){
//Do something
})

and

$(xml).find("test\\:company, company").each(function(){
//Do something
})

The Problem is the Do something code is not being reached

Change History (1)

comment:1 Changed 11 years ago by dmethvin

Resolution: notabug
Status: newclosed

$(xml) does not parse XML. $.parseXML() parses XML. I don't know whether your namespace works everywhere, but fix that first.

There is no nodeName attribute in the markup so that should not work.

Not sure where the "test" namespace comes from.

This works for me: http://jsfiddle.net/dmethvin/FbSmh/

Please ask for help on a forum.

Note: See TracTickets for help on using tickets.