473,568 Members | 2,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

java works, but xmlspy seems broken and some xsd and space questions?

hi, trying to convert some csv files into xsml and pulling a few hairs
out :(. using the files below. a java program will parse the csv and
take care of strange names and notes that line breaks in them.

eventiually i want to generate the xslt from a xml file (all the files
and java code are at http://tayek.com/~ray/spy1/).

the java code (1.4) does the right thing (it just does the
transformation) . xmlspy seems really broken when i hit f10 to run the
inputDocument.x ml through the sampleT1.xslt (i am trying the enterprize
version). even putting in <xsl:text> </xsl:text>", the spy just
seems to ignore it (but the java does something reasonable).

also, i have text in my xslt like <outputRow> and later </outputRow>.
this is one of the things what xmlspy seems to discard.

the field names from the csv (called inputFieldName in the xml) can
contain some screwball stuff line ' and ", so i made these text
elements an xs:string. they can not contain any other xml (i.e. no
<...>). so is xs:string the right way to do this? or should one use
normalized string?

what does nillable mean or do? - it lets things be empty? is there a way
to force things to have just attributes and no content?

there should be *no* text or any other markup (ignoring specal for the
moment) anywhere except for inside an inputField or an inputFieldName.
is there a way to tell the schema thia?

eventually, i want to use the a file like inputDocumentMa p.xml to
generate the xslt using xslt (i am doing this now in java, but with a
different inputDocumentMa p.xml file).

any pointers would be appreciated.

thanks
file inputDocument.x ml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 (http://www.xmlspy.com) by Ray
Tayek (Freightgate) -->
<!--Sample XML file generated by XMLSPY v2004 rel. 3 U
(http://www.xmlspy.com)-->
<inputDocumen t xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "H:\java\projec ts\spy1\spy\inp utDocument.xsd" >
<special>Text </special>
<header>
<inputFieldName >copy1</inputFieldName>
<inputFieldName >remove1</inputFieldName>
<inputFieldName >rename1</inputFieldName>
<inputFieldName >special1</inputFieldName>
<inputFieldName >special2</inputFieldName>
</header>
<inputRecords >
<inputRecord>
<inputField>cop y1Value1</inputField>
<inputField>rem ove1Value1</inputField>
<inputField>ren ame1Value1</inputField>
<inputField>spe cial1Value1</inputField>
<inputField>spe cial2Value1</inputField>
</inputRecord>
<inputRecord>
<inputField>cop y1Value2</inputField>
<inputField>rem ove1Value2</inputField>
<inputField>ren ame1Value2</inputField>
<inputField>spe cial1Value2</inputField>
<inputField>spe cial2Value2</inputField>
</inputRecord>
</inputRecords>
</inputDocument>

file inputDocument.x sd:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Ray
Tayek (Freightgate) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:element name="inputDocu ment">
<xs:annotatio n>
<xs:documentati on>input csv converted to xml</xs:documentatio n>
</xs:annotation>
<xs:complexType >
<xs:sequence>
<xs:element name="special" type="xs:anyTyp e" minOccurs="0"/>
<xs:element name="header" minOccurs="0">
<xs:complexType >
<xs:sequence>
<xs:element name="inputFiel dName" type="xs:string "
nillable="false " minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="inputReco rds" minOccurs="0">
<xs:complexType >
<xs:sequence>
<xs:element name="inputReco rd" minOccurs="0" maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="inputFiel d" type="xs:string "
nillable="false " minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
files sampleT.xslt:

<?xml version="1.0" encoding="UTF-8"?>
<?xmlspysamplex ml inputDocument.x ml?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<!--<xsl:strip-space elements="*"/>-->
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/inputDocument">
<outputDocument >
<xsl:apply-templates/>
</outputDocument>
</xsl:template>
<xsl:template match="/inputDocument/special">
</xsl:template>
<xsl:template match="/inputDocument/header">
</xsl:template>
<xsl:template match="/inputDocument/inputRecords">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="/inputDocument/inputRecords/inputRecord">
<!--<xsl:for-each select="child:: *[position()=4 or position()=5]">
works -->
<xsl:for-each select="child:: *">
<xsl:if test="position( )=4">
<xsl:call-template name="generateO utputRecord">
<xsl:with-param name="value1" select="'new1Va lueFromSpecial1 Name'"/>
<xsl:with-param name="value2" select="'new2Va lueFromSpecial1 Name'"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="position( )=5">
<xsl:call-template name="generateO utputRecord">
<xsl:with-param name="value1" select="'new1Va lueFromSpecial2 Name'"/>
<xsl:with-param name="value2" select="'new2Va lueFromSpecial2 Name'"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="generateO utputRecord">
<xsl:param name="value1" select="default Value1"/>
<xsl:param name="value2" select="default Value2"/>
<outputRow>
<inputRecordSeq uenceNumber>
<xsl:number count="inputRec ord"/>
</inputRecordSequ enceNumber>
<xsl:for-each select="../*">
<xsl:call-template name="processFi eld"/>
</xsl:for-each>
<xsl:call-template name="addNewFie lds">
<xsl:with-param name="xvalue1" select="$value1 "/>
<xsl:with-param name="xvalue2" select="$value2 "/>
</xsl:call-template>
</outputRow>
</xsl:template>
<xsl:template name="addNewFie lds">
<xsl:param name="xvalue1" select="default Value1"/>
<xsl:param name="xvalue2" select="default Value2"/>
<xsl:element name="new1">
<xsl:value-of select="$xvalue 1"/>
</xsl:element>
<xsl:element name="new2">
<xsl:value-of select="$xvalue 2"/>
</xsl:element>
<xsl:element name="new3">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template name="processFi eld">
<xsl:choose>
<xsl:when test="position( )=4"/>
<xsl:when test="position( )=5"/>
<xsl:when test="position( )=2"/>
<xsl:when test="position( )=3">
<xsl:element name="renamed1" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:when>
<xsl:when test="position( )=1">
<xsl:element name="{/inputDocument/header/inputFieldName[1]}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:when>
<xsl:otherwis e>
<xsl:element name="{name()}" >
<xsl:value-of select="."/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--
-->
</xsl:stylesheet>

output from spy:

1 copy1Value1 rename1Value1 new1ValueFromSp ecial1Name
new2ValueFromSp ecial1Name special1Value1 1 copy1Value1 rename1Value1
new1ValueFromSp ecial2Name new2ValueFromSp ecial2Name special2Value1 2
copy1Value2 rename1Value2 new1ValueFromSp ecial1Name
new2ValueFromSp ecial1Name special1Value2 2 copy1Value2 rename1Value2
new1ValueFromSp ecial2Name new2ValueFromSp ecial2Name special2Value2

output from java program: file outputDocument_ .xml:

<?xml version="1.0" encoding="UTF-8"?>
<outputDocument >
<outputRow>
<inputRecordSeq uenceNumber>1</inputRecordSequ enceNumber>
<copy1>copy1Val ue1</copy1>
<renamed1>renam e1Value1</renamed1>
<new1>new1Value FromSpecial1Nam e</new1>
<new2>new2Value FromSpecial1Nam e</new2>
<new3>special1V alue1</new3>
</outputRow>
<outputRow>
<inputRecordSeq uenceNumber>1</inputRecordSequ enceNumber>
<copy1>copy1Val ue1</copy1>
<renamed1>renam e1Value1</renamed1>
<new1>new1Value FromSpecial2Nam e</new1>
<new2>new2Value FromSpecial2Nam e</new2>
<new3>special2V alue1</new3>
</outputRow>
<outputRow>
<inputRecordSeq uenceNumber>2</inputRecordSequ enceNumber>
<copy1>copy1Val ue2</copy1>
<renamed1>renam e1Value2</renamed1>
<new1>new1Value FromSpecial1Nam e</new1>
<new2>new2Value FromSpecial1Nam e</new2>
<new3>special1V alue2</new3>
</outputRow>
<outputRow>
<inputRecordSeq uenceNumber>2</inputRecordSequ enceNumber>
<copy1>copy1Val ue2</copy1>
<renamed1>renam e1Value2</renamed1>
<new1>new1Value FromSpecial2Nam e</new1>
<new2>new2Value FromSpecial2Nam e</new2>
<new3>special2V alue2</new3>
</outputRow>
</outputDocument>

inputDocumentMa p.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 (http://www.xmlspy.com) by Ray
Tayek (Freightgate) -->
<!--Sample XML file generated by XMLSPY v2004 rel. 3 U
(http://www.xmlspy.com)-->
<inputDocumentM ap xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "H:\java\projec ts\spy1\spy\inp utDocumentMap.x sd">
<inputFieldMa p>
<inputFieldname >copy1</inputFieldname>
<map>
<from>oldValue1 </from>
<to>newValue1 </to>
</map>
<map>
<from>oldValue2 </from>
<to>newValue2 </to>
</map>
</inputFieldMap>
<inputFieldMa p delete="true">
<inputFieldname >remove1</inputFieldname>
</inputFieldMap>
<inputFieldMa p>
<inputFieldna me outputFieldName ="renamed1">ren ame1</inputFieldname>
</inputFieldMap>
<inputFieldMa p delete="true">
<inputFieldname >special1</inputFieldname>
<generate outputFieldName ="new1">new1Val ueFromSpecial1N ame</generate>
<generate outputFieldName ="new2">new2Val ueFromSpecial1N ame</generate>
<generate outputFieldName ="new3" copyOriginalVal ue="true">will be
ignored</generate>
</inputFieldMap>
<inputFieldMa p delete="true">
<inputFieldname >special2</inputFieldname>
<generate outputFieldName ="new1">new1Val ueFromSpecial2N ame</generate>
<generate outputFieldName ="new2">new2Val ueFromSpecial2N ame</generate>
<generate outputFieldName ="new3" copyOriginalVal ue="true">will be
ignored</generate>
</inputFieldMap>
</inputDocumentMa p>
inputDocumetMap .xsd file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Ray
Tayek (Freightgate) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:element name="inputDocu mentMap">
<xs:annotatio n>
<xs:documentati on>Comment describing your root element</xs:documentatio n>
</xs:annotation>
<xs:complexType >
<xs:sequence>
<xs:element name="inputFiel dMap" minOccurs="0" maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="inputFiel dname" nillable="false ">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="outputFie ldName" type="xs:Name"
use="optional"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>
<xs:element name="map" nillable="false " minOccurs="0"
maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="from" type="xs:string " nillable="false "/>
<xs:element name="to" type="xs:string " nillable="false "/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="generate" minOccurs="0" maxOccurs="unbo unded">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="outputFie ldName" type="xs:string "
use="required"/>
<xs:attribute name="copyOrigi nalValue" type="xs:boolea n"
use="optional" default="false"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="delete" type="xs:boolea n" use="optional"
default="false"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Jul 20 '05 #1
0 2156

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1819
by: Lars | last post by:
Hi all, I suspect this may be a bug in XMLSpy, since IE seems to validate this XML successfully. Maybe someone here has run into this and can tell me. Problem: When I try to validate the XML document hans-cc.xml in XMLSpy, it gives me the error Undefined ID 'comp-cl' referred to from attribute 'styleID' I have an XML file hans-cc.xml...
2
2070
by: Patrick J. Maloney | last post by:
I received a file from a business partner. I ran it through XercesJ and it choked on the following element: <wcb-case-number>0</wcb-case-number> To debug this issue, I loaded it into XMLSPY and hit validate...it passed. Here are the related type/element definitions: // Redefine built-in string type to limit range of characters, mostly...
8
1691
by: Beatrice Rutger | last post by:
Hi, I am a previous Micro$oft desertee (moved from VB/VC++ to Java before this whole DOTNET thing) because I had several issues with Micro$oft. I am not completely in love with Windoze, but I have to say that Java SWING sucks BIG TIME for developing and deploying desktop applications (especially on Windoze). Unfortunately, I have been...
235
11551
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could stay with C and still be able to produce Java byte code for platform independent apps. Also, old programs (with some tweaking) could be...
1
9606
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the...
2
6937
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
6
4489
by: quanghoc | last post by:
Hi all, I used XMLSpy to validate my XML but it catched one error at a time. Is there anyway to make XMLSpy to catch all errors at once. If XMLSpy does not have this feature, what software out there can do this? I have a very large document with many related files and validating one by one is a hassle. I want to see all errors and fix it all...
318
10833
by: King Raz | last post by:
The shootout site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmark on the site ... http://kingrazi.blogspot.com/2008/05/shootout-c-net-vs-java-benchmarks.html Just to keep the post on topic for my friends at comp.lang.c++, how do I play default windows...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.