5.0

5.0 | 1 rating Rate this file 21 Downloads (last 30 days) File Size: 3.39 KB File ID: #31382

Using XPath from MATLAB

by

 

A simple example showing how to use XPath from MATLAB.

| Watch this File

File Information
Description

An XPath package started shipping as part of Java 5, so we can use it from MATLAB. This is a simple example showing how to use XPath from MATLAB.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
13 Feb 2014 Ferdinando

Hi Matthew,

I need to extract data (e.g. all the noduleID) from my xml file, having a structure like the following (but with more 'unblindedReadNodule' nodes):

<?xml version="1.0" encoding="UTF-8"?>
<LidcReadMessage uid="1.3.6.1.4.1.14519.5.2.1.6279.6001.1307390687803.0" xmlns="http://www.nih.gov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nih.gov http://troll.rad.med.umich.edu/lidc/LidcReadMessage.xsd">
<ResponseHeader>
<Version>1.8.1</Version>
<MessageId>-421198203</MessageId>
<DateRequest>2007-11-01</DateRequest>
<TimeRequest>12:30:44</TimeRequest>
<RequestingSite>removed</RequestingSite>
<ServicingSite>removed</ServicingSite>
<TaskDescription>Second unblinded read</TaskDescription>
<CtImageFile>removed</CtImageFile>
<SeriesInstanceUid>1.3.6.1.4.1.14519.5.2.1.6279.6001.179049373636438705059720603192</SeriesInstanceUid>
<DateService>2008-08-18</DateService>
<TimeService>02:05:51</TimeService>
<ResponseDescription>1 - Reading complete</ResponseDescription>
<StudyInstanceUID>1.3.6.1.4.1.14519.5.2.1.6279.6001.298806137288633453246975630178</StudyInstanceUID></ResponseHeader>
<readingSession>
<annotationVersion>3.12</annotationVersion>
<servicingRadiologistID>540461523</servicingRadiologistID>
<unblindedReadNodule>
<noduleID>Nodule 001</noduleID>
<characteristics>
<subtlety>5</subtlety>
<internalStructure>1</internalStructure>
<calcification>6</calcification>
<sphericity>3</sphericity>
<margin>3</margin>
<lobulation>3</lobulation>
<spiculation>4</spiculation>
<texture>5</texture>
<malignancy>5</malignancy>
</characteristics>
<roi>
<imageZposition>-125.000000 </imageZposition>
<imageSOP_UID>1.3.6.1.4.1.14519.5.2.1.6279.6001.110383487652933113465768208719</imageSOP_UID>
<inclusion>TRUE</inclusion>
<edgeMap>
<xCoord>312</xCoord>
<yCoord>355</yCoord>
</edgeMap>
</roi>
</unblindedReadNodule>
</readingSession>
</LidcReadMessage>

I tried to use your function, with only two appropriate changes:
doc = xmlread(which('myFileName.xml'));
expression = xpath.compile('//noduleID');
but I got no display!

Could you help me?

Thank you for your attention.

Ferdinando

Contact us