Rank: 3261 based on 36 downloads (last 30 days) and 2 files submitted
photo

Jarrod Rivituso

E-mail
Company/University
The MathWorks

Personal Profile:

 

Watch this Author's files

 

Files Posted by Jarrod Rivituso View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
24 Oct 2014 Screenshot XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso xml xpath java namesp..., xml, namespace, namespaces, java, indexing 19 8
  • 4.4
4.4 | 6 ratings
18 Dec 2006 File I/O C S-function Example A simple C S-function which reads data from a file during simulation. Author: Jarrod Rivituso data import, data export, c, mex, sfunction, cmex 17 3
  • 3.75
3.8 | 4 ratings
Comments and Ratings by Jarrod Rivituso View all
Updated File Comments Rating
14 Feb 2014 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso

Hi Ferdinando,

The elements in your XML file are all in the 'http://www.nih.gov' namespace, as indicated by the xmlns='http://www.nih.gov' attribute in LidcReadMessage.

When extracting data from an element in a particular namespace using XPath, you must add the namespace prefix. XMLNode automatically finds the prefixes in your document and provides them for you in the command window output when you first open the file.

So, you should be able to use syntax like below to extract your data (note that 'pre1' is the name of the http://www.nih.gov previx that was assigned by XMLNode automatically.

>> n = XMLNode('myFileName.xml')
>> data = n{'//pre1:noduleID'}

15 Dec 2013 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso

Bryan - sorry for the delay in getting back to you.

I think this may be due to the application not finding the input file specified. I'm not sure whether it is a path issue, or an issue regarding how the file name is being parsed (I found in my testing that certain absolute paths would behave strangely when compiled).

Some things you could try:

1. Try using absolute paths instead of relative paths

2. Try replacing line 80 of XMLNode
fileName = which(node);
with
fileName = node;
to see if this helps (it did for me in my testing)

I was using the "which" function to enable the tool to find any file on the MATLAB path. However, I'm not 100% sure how that plays with the path in a compiled version of the app. I think I'd like to more seriously consider these issues and then upload an update.

Thanks!

18 May 2012 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso

Thanks Jeremy! Those are good ideas :)

03 Mar 2012 GUI Layout Toolbox Layout management objects for MATLAB GUIs Author: Ben Tordoff

Comments and Ratings on Jarrod Rivituso's Files View all
Updated File Comment by Comments Rating
02 May 2014 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso Jean-Baptiste Lanfrey

I was able to parse a big xml file in no time. No loop involved, just a few lines of code.
This is brilliant!

14 Feb 2014 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso Jarrod Rivituso

Hi Ferdinando,

The elements in your XML file are all in the 'http://www.nih.gov' namespace, as indicated by the xmlns='http://www.nih.gov' attribute in LidcReadMessage.

When extracting data from an element in a particular namespace using XPath, you must add the namespace prefix. XMLNode automatically finds the prefixes in your document and provides them for you in the command window output when you first open the file.

So, you should be able to use syntax like below to extract your data (note that 'pre1' is the name of the http://www.nih.gov previx that was assigned by XMLNode automatically.

>> n = XMLNode('myFileName.xml')
>> data = n{'//pre1:noduleID'}

13 Feb 2014 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso Ferdinando

Hi Jarrod,

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 you function...
startup
n=XMLNode('myFileName.xml');
noduleIDNodes=n('//noduleID')

But I got an empty display

noduleIDNodes =

[]

I think that with this instructions i get the nodeList instead of the text value of each node, as i would like.

Could you help me?

Thank you for your attention.

Ferdinando

13 Feb 2014 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso Ferdinando

15 Dec 2013 XMLNode MATLAB class that allows you to use XPath to navigate and extract data from an XML document. Author: Jarrod Rivituso Jarrod Rivituso

Bryan - sorry for the delay in getting back to you.

I think this may be due to the application not finding the input file specified. I'm not sure whether it is a path issue, or an issue regarding how the file name is being parsed (I found in my testing that certain absolute paths would behave strangely when compiled).

Some things you could try:

1. Try using absolute paths instead of relative paths

2. Try replacing line 80 of XMLNode
fileName = which(node);
with
fileName = node;
to see if this helps (it did for me in my testing)

I was using the "which" function to enable the tool to find any file on the MATLAB path. However, I'm not 100% sure how that plays with the path in a compiled version of the app. I think I'd like to more seriously consider these issues and then upload an update.

Thanks!

Contact us