Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Searching xml elements by id

Subject: Searching xml elements by id

From: Øyvind

Date: 22 Apr, 2010 20:43:05

Message: 1 of 1

I'm reading an xml file using Matlab's xmlread-function. For some reason searching for elements by id doesn't work for me. Here's an example:

File 'test.xml':

<?xml version="1.0" encoding="utf-8"?>
    <Setup id="a">
    <Setup id="b">

>> dom = xmlread('test.xml');
>> dom.getElementsByTagName('Setup')
ans =
>> dom.getElementById('a')
ans =

The first call, searching for elements by tagname works fine, but not searching by id. This should work, according to

Does anyone see what's going on here?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us