Skip to main content
Hi,

 

I'm trying to read a fairly complicated XML format that I know nothing about (Government standard, 220 page spec, etc) and don't know where to begin. The Webinar for Reading XML is a bit broken (no video, at least some of the demo's error-out) so I'm stumped.

 

 

I have a XML (like: http://www.dft.gov.uk/transxchange/schema/2.1/examples/express/express.xml) but FME (either 2012 or 2013) refuses to read it.

 

 

I get: |ERROR |Unable to configure the XML module to read the XML dataset. No <xrs:switch> item in the xrs document 'C:\\apps\\FME_2013_64\\xml\\xrs\\xrs.xml' matched the XML dataset 'C:/Users/jmou1.WCC-CORP/Desktop/20121128 WarwTT/twm_8-201_-1-y11.xml'

 

|ERROR |The XML format could not be determined by examination. Try entering a feature path into the "Elements to Match" parameter, specifying an xfMap, selecting an XRS, or using a more specific reader

 

While there is a XSD collection (http://www.dft.gov.uk/transxchange/schema/2.1/TransXChange_schema_2.1.zip) but there's no XRS or xfMap in there.

 

 

I can manuall specify some "Elements to match" (i.e. "StopPoints") and this does then create a reader which in turn only had one feature which has everything as a list. I could explode this, but is this best practice? I don't know what all of my potential "Elements to match" are.

 

 

Can I get FME to just use the nice DTD and/or XSD files?

 

 

Thanks
Hi,

 

 

If you use a good text editor (Notepad++) you can easly find all the elements in the XML file, just add them into the elements to match (e.i. StopPoints StopPoint, etc) and you should be good to go.

 

Then you dont need to use any XSD files.

 

 
Here is a video that might help

 

http://www.youtube.com/watch?v=C2QExC3DZQ0
Hi Itay, Thanks for the responses.

 

I've already done the notepad++ thing, problem is, its a complicated file and I'm not convinced this won't lose data or structural information.

 

 

Also, it doesn't seem to work properly. For example, one set of actual "features" are called "StopPoint" but when I add that, FME adds no reader. So I need to add "StopPoints" (the Parent that contains them all). This gives me one feature which contains a list which is what I was referencing in my First post.

 

While I could probably contrive something using this, that seems rather roundabout and the results undesireable when I have a nice set of XSD/DTD files.
Hi,

 

Strange if i use:

 

 

StopPoints

 

StopPoint 

 

 

in the elements to macht I get 6 features.

 

 

But I agree, making use of the schema is the best option, having a closer look at the error message makes me think that FME cannot find the schema documents in you local machine.

 

Acoording to the FME documentation there are several options, see 

 

C:\\Program Files\\FME\\xml\\schemas\\readme.txt

 

Beside that are you sure that the xrs.xml document is in the correct location? (C:\\apps\\FME_2013_64\\xml\\xrs)

 

In my case I it is located in C:\\Program Files\\FME\\xml\\xrs  
Hi Again,

 

You're right. For further confusion the actual data I have (which is what I was testing against) uses "AnnotatedStopPointRef" rather than "StopPoint" as the child node. This would be another reason for desiring to use the XSD. :-)

 

 

I wasn't aware I could make FME look for XSD documents by placing them in a specific directory so they were just lying around somewhere on the machine.

 

 

I've now found my /xml/schemas directory but am unclear how to proceed.

 

For one thing the readme.txt doesn't make much sense to me, partly because I don't know the structure of the XSD files I want (there are quite a lot in that document), and partly because I can't change my namespaceURI can I?

 

 

Also (and more importantly) I don't want to change anything in here because then when I update my FME (which I do regularly) it will be deleted and my loader won't work. Is it possible to just point FME to a directory with the XSD's in, in the same way that I can point FME to directories with other things in?

 

 

Thanks
Hi,

 

 

As you know there are only 3 configuration options in the xml reader (XRS, xfMAp and feature paths) since none of the first two are available in the zip file, that leaves the feature path option (not desired).

 

Unfortunatly this is as far as it can go with the xml reader, did you have a look at the gml reader?, it does have the option to point to a schema document.
I didn't know the GML reader did that. I've just spent a few minutes trying it, pointing it at various XSD files but nothing gets read in. Usually the error is:

 

 

|WARN  |<GML Reader> - No GML features were found in the set of XML Schemas, make sure that at least one of the schemas is a user, domain or community-specific "GML Application Schema".

 

I'm stumped. But this does remind me why I avoid XML where-ever possible. 🙂
:)

 

Yes got that too... :(

 

 

XML is fun, used to be scared of it too, but got over it.....

 

shame I cant help you any more...hopefuly someone from Safe will pick this up. Otherwise I would recommend  you to approach Juan (juan.chuchow@safe.com)
Thanks for the help Itay.

 

I've decided to just go with the Flattening for now and have just encountered the first non-obvious problem.

 

 

Somewhere in the XML I have something like this:

 

 

            <OperatingProfile>

 

                <RegularDayType>

 

                    <DaysOfWeek>

 

                        <Wednesday />

 

                    </DaysOfWeek>

 

                </RegularDayType>

 

            </OperatingProfile>

 

 

Which comes up as an attribute like:

 

OperatingProfile.RegularDayType.DaysOfWeek.Wednesday with no value

 

Except of course, "Wednesday" is supposed to be the value and not part of the attribute name.

 

This becomes a problem when other XML files have different "values" -

 

They're not exposed because the reader isn't expecting them having been trained for this (so there goes attribute keeper/remover). Furthermore I can't think of a good way of getting the values because there are *lots* of potential combinations so AttributeExposer wouldn't be sensible.

 

 

Is there an option I've missed for ensuring that that is read as an attribute value properly?
Hi, Cant think of a way to do it by reading but you could search for an attribute containing null values which ends up with a week day. This can be split and tne week day can become the value.
Problem is, I can't search for the attribute because its not even guaranteed to be exposed. I guess I could cobble together some python to loop through the attributes (that does included non-exposed ones right?), but this all seems to be fighting against FME.
I've been using the same NaPTAN data set and although I've been able to read in the tables using the FME FDO connector in AutoCAD I can't display the information in the drawing.

@jonathan_deactivate I know it's been a few years since you posted this, but I was wondering whether you managed to sort out your "Wednesday" problem

(OperatingProfile.RegularDayType.DaysOfWeek.Wednesday)? I'm trying to translate TXC file into something more useful using FME and struggling with that one too...


Reply