XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
McKyle AdamsSubject: Help with strange XML file - please
Author: McKyle Adams
Date: 11 Jun 2006 01:16 AM
Originally Posted: 11 Jun 2006 12:48 AM
I have an XML file I received from a large corp. - it is generated by them to supposedly make it "easy' for me to bring the data from a transaction into our organization - I'm using an Access database for the time being. Since Access reads only element-centric xml and won't read the file (actually, it reads but makes a bunch of empty tables), I concluded the file is attribute-centric - also based on the file structure. So I went to the MS site and found VB .NET code for converting back and forth between attribute-centric and element-centric and I built a VB .NET app. The code works fine on other examples files, but not on the file of interest - I get warnings from the XML DOM that the code is not attribute-centric, nor is it element-centric. Would someone be willing to look at the file and tell me how I might read it? Thanks very much.

McKyle


UnknownXACTDOC.XML

Postnext
Ivan PedruzziSubject: Help with strange XML file - please
Author: Ivan Pedruzzi
Date: 12 Jun 2006 09:42 AM
Hi McKyle,

It seems like that Microsoft Access doesn't like the document shape.

You may try to use the attached XSLT (Attribute-to-Element.xsl) to pre-process the XML before importing the data.

See how to apply XSLT in the XML Import Wizard here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ac2003_ta/html/odc_ac_xsd.asp

Notice that I ignore the attribute sketchDockInfo because seems to contain only comments

Access text fields are limited to 255 characters so you may see still error after the import.

I am also attaching a XML schema (XACTDOC.xsd) that can be used to instruct the import engine in how to convert the XML.

The XSLT instruction that emits the schema reference is there but commented out for your reference.

Please see the following to learn how MS Access supports XML Schema
http://msdn.microsoft.com/library/en-us/odc_ac2003_ta/html/odc_ac_xsd.asp


Hope this helps
Ivan Pedruzzi
Stylus Studio Team


DocumentAttribute-to-Element.xsl


DocumentXACTDOC.xsd

Postnext
McKyle AdamsSubject: Help with strange XML file - please
Author: McKyle Adams
Date: 12 Jun 2006 12:41 PM
Hello Ivan - thanks very much for the response.

I read the article, and I'm not clear on how to apply the XSLT during import - I may have missed something, but when I run the import per the instructions on that page, I don't see a place to apply the XSLT. Is it automatically applied by naming it the same filename prefix perhaps? I'm sorry I'm being slow about this process - I haven't worked with it before. I also looked at the MS web document regarding the schema (xsd) - the two links appear to be the same page and I guess I'm not clicking to what needs to be done.

It appears I can import the xsd before importing the xml file and it makes tables - is that the preprocessing you were referring to?

Sorry for my lack of understanding, and thanks for your patience.

McKyle

Postnext
Ivan PedruzziSubject: Help with strange XML file - please
Author: Ivan Pedruzzi
Date: 12 Jun 2006 02:48 PM

Sorry wrong link
See the chapter "Import Data" to apply XSLT
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ac2003_ta/html/odc_accessnewxmlfeatures.asp

If the XML document you are trying to import points to a XML Schema like the following example, Access uses the schema information to map the elements to appropriate column types.

<?xml version='1.0' ?>
<XACTDOC
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:///c:/temp/XACTDOC.xsd">
...

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
McKyle AdamsSubject: Help with strange XML file - please
Author: McKyle Adams
Date: 12 Jun 2006 07:32 PM
Ivan, you're a dang genious! Thanks very much - that got me the data in a hell of a lot better shape than before. I think it's all there. How did you generate that xsl file, or is that a generic file? How about the xsd? Did you do those with Stylus Studio?

Thanks again - if you ever come to New Mexico and want to go for a horse ride, look me up - we have 8 percherons (police horses).

McKyle

Posttop
Ivan PedruzziSubject: Help with strange XML file - please
Author: Ivan Pedruzzi
Date: 13 Jun 2006 02:34 PM


The XSLT is a generic trasforation to copy everything and translates attributes into elements.

To generate the schema I used the Stylus Studio XML Editor.

Thank You for the offer if it happens to visit New Mexico I will give a buzz.


Ivan Pedruzzi
Stylus Studio Team

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.