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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> - XSL-fo and how to line feed th... (1)
-> + Houston we have a problem (2)
-> + XSL-FO PDF generation (2)
-> + StylusStudio - pick XSLT 1.0 b... (6)
-> - Stylus Studio 2010 debugging f... (1)
-> - Drop down menu List / Option M... (1)
-> - XML transformation using Java ... (1)
-> + i can't to find XSLT editor in... (2)
-> - Copy xml input as value of an ... (1)
-> - Remove Name space from the Tab... (1)
-> - CGI formatted URL with name/va... (1)
-> - Problem with counting (1)
-> + for-each loop is only returnin... (3)
-> - sort date but some dates may b... (1)
-> - Entity Conversion (1)
-> - How can I build an xml convert... (1)
-> + Little Help (2)
-> + how do I merge nodes to one sc... (2)
-> - beginner help xslt and xpath (1)
-> - Convert XML Feed to CSV/SQL/XL... (1)
-> - Working with text node. (1)
-> - No Topic (1)
-> - API for XSLT Converter for .NE... (1)
-> - Getting started (1)
-> + saxon sql extensions - mysql a... (2)
-> - How do I copy and create new e... (1)
-> + substring-before and sums (3)
-> + Parsing special characters in ... (2)
-> + Schema - Require attribute in ... (2)
-> - Edit existing XSL files when n... (1)
-> + How can I use one single XSLT ... (2)
-> - Default selection of value in ... (1)
-> - Problem with watermark in pdf ... (1)
-> + XSLT Parameter Values dialog n... (3)
-> + Value of File Name is not acce... (10)
-> - Need help with a complex table... (1)
-> - How to replace all nordic char... (1)
-> - XSLT java heap space error wit... (1)
-> - Table Overflow to next page (1)
-> - Using XSLT 2.0 to define custo... (1)
-> - "standalone" attribute and xs... (1)
-> + Standardizing IP addresses (2)
-> + Programmatically changing page... (6)
-> + Can Stylus generate XSLT if so... (5)
-> + Extraction based on NODE Name. (2)
-> + NO XSLT:WYSIWYG (2)
-> + determine condition at run tim... (2)
-> - How to reduce top margin in ev... (1)
-> + need help on xsl looping (4)
-> - Convert Symbol to Element (1)
-> + Separator -only- between field... (3)
-> + DocBook (9)
-> + First Occurance of Alphabet (2)
-> + XSL:Key and Document (2)
-> + Excel Macro using XSLT (2)
-> + Add missing element and attrib... (2)
-> + XSL: Stop Count at First Match (2)
-> + XSD to EDI (4)
-> + How to access data from nested... (2)
-> + Simple division of XML file (2)
-> - XML to Flat File (1)
-> + Dispalying data whith xsl:for ... (3)
-> - distinct nodes - into 3 column... (1)
-> + Newbie at XML (2)
-> + XSL Not Working (3)
-> + to draw table using xsl (2)
-> + Base64 decoder (5)
-> + How to create a hidden sheet u... (3)
-> + XML Reports (2)
-> + Copying image files from one d... (2)
-> + XML conversion to RSS (2)
-> + Inserting Image (2)
-> + Xml to Pdf using Xsl (2)
-> + Using a parameter (or similar)... (2)
-> + How to avoid creating empty xm... (2)
-> + how to read txt files in xml (2)
-> + Limit records to 4 per page. P... (4)
-> + XSLT Mapping Based on JDK5 (2)
-> + XML Mappin (2)
-> + Format Datetime with xslt (3)
-> + Cell border missing (2)
-> + XSL: Key (not matches) (5)
-> + Loop through each char in stri... (2)
-> + What is the best way to sum va... (3)
-> + xslt sort help (2)
-> + getting the count (2)
-> + XSL dynamic variables (5)
-> + XSL:Key use (3)
-> + Help With Updating Attributes ... (8)
-> + GETTING COUNT AND POSITION usi... (3)
-> - Hi Everyone !! (1)
-> + Graph Traversal (Keep track of... (2)
-> + XSL IF with sum (2)
-> + Param not incrementing (2)
-> + Iterating through value tags (3)
-> + URGENT :::: Remove the name sp... (2)
-> + Pass new param values to ASP O... (2)
-> + Detect Browser Version in XSL (2)
-> + xslt result-document (2)
-> + Unique nodes based on two attr... (3)
-- Previous [181-200] [201-220] [221-240] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Bruno F
Date: 20 Oct 2005 06:00 AM
Dear all,

I'm currently using the wizard to convert XML schemata to XML instances.

Is there any way to avoid having whitespaces in number data types with explicit format (e.g. long, decimal)?

The whitespaces appear when the actual number is not using up the "totaldigits" slots.
Imho these whitespaces should not exist or be optional.


Example:
XSD:
<xs:element name="Numberfield">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

XML-Output:<br>
<Numberfield>__blank_1.23</Numberfield>

I added the "__blank_" cause excess blanks seem to be filtered by this forum :)

Expected Output:<br>
<Numberfield>1.23</Numberfield>



Thank you for any help,
best regards,
Bruno

Postnext
(Deleted User) Subject: Unwanted blanks in XML schema / XSD to XML conversion
Author: (Deleted User)
Date: 20 Oct 2005 10:10 AM
We don't have an option to turn off number padding.
Can I ask you why you think this is a problem?
I was under impression that this will give user
an idea how many digits he/she can use when replacing
sample number with some actual value in generated XML.
I can of cause change it to fill unused slots with "0" or "1"
instead of spaces...

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Bruno F
Date: 20 Oct 2005 11:50 AM
Its a formal requirement on how we test our software product.
For the test we need synthetic data that looks like real data - which won't feature padding.

An option would be really nice...

Cheers,
Bruno

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Bruno F
Date: 09 Jan 2006 10:57 AM
Dear Yuriy,

I see that in StylusStudio 6 you introduced the padding with zeroes :)

One case might be an issue - some validation engines dont accept what StylusStudio generates:

Example XSD:

<xs:schema xmlns="Schemas/Art100/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="Schemas/Art100/1.0" elementFormDefault="qualified">
<xs:element name="Art">
<xs:complexType>
<xs:sequence>
<xs:element name="Top" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Sub" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:totalDigits value="12"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Generated XML:
<p1:Top>
<p1:Sub>0000727379969</p1:Sub>
</p1:Top>

The proble is that the resulting number has 13 digits, whereas the restriction was set to 12 digits.
Some engines ignore the leading zeros, some don't and report an error.

Anyway, I think that padding should not put too much zeros or is there a reason that this is desired functionality?

It would be really nice to have an "Option"-Switch for padding anyways.

Thx for an answer & kind regards,
Bruno

Postnext
Tony LavinioSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Tony Lavinio
Date: 09 Jan 2006 12:02 PM
We'll look into it, however, our behavior is completely conformant,
so it is doubtful our behaviour will change.

http://www.w3.org/TR/xmlschema-2/#dt-totalDigits says (especially the
last sentence)

"The term totalDigits is chosen to reflect the fact that it restricts
the ·value space· to those values that can be represented lexically
using at most totalDigits digits. Note that it does not restrict the
·lexical space· directly; a lexical representation that adds additional
leading zero digits or trailing fractional zero digits is still
permitted."

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Bruno F
Date: 09 Jan 2006 01:30 PM
Thanks for the quick reply, Tony.

I agree there might be more critical issues to look into :) ... I just wanted to remark that the number padding in this case fails to deliver the proposed functionality. According to Yuriy, the padding was introduced to allow users to quickly edit the XML instance without looking into the XSD.

Cheers,
Bruno

Postnext
Tony LavinioSubject: Unwanted blanks in XML schema / XSD to XML conversion
Author: Tony Lavinio
Date: 09 Jan 2006 01:58 PM
I'll make a note in the issues database, and we'll just remove
some of those extra zeros from Yuriy's paycheck also :).

Seriously, this has been noted in our database as a potential
to-do item.

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Bruno F
Date: 10 Jan 2006 05:19 AM
*rofl*

sounds good... especially because I just came across a couple of issues on which I would greatly appreciate your opinion.

I'm still concerned with the "XML Schema to XML"-Functionality.

Issues:
- Generated XML is not valid when mutliple facets apply (esp. a regular expression pattern and minInclusive/maxInclusive)
- Generated XML depends on the order of restriction facets (below cases put the pattern first and last, respectively)
- Number padding is not working for these cases (minor issue).

I am currently working on a project where we have to deal with a large amount of complex schemata featuring stuff like you see below. I need to regularly create XML instances...

Here are XSD Samples and XML generated by StylusStudio. Both are reported invalid by StylusStudio.

Sample XSD 1:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="Schemas/Typ9002/1.0" elementFormDefault="qualified" targetNamespace="Schemas/Typ9002/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Type">
<xs:complexType>
<xs:sequence>
<xs:element name="StandardData">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,16}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="18" />
<xs:maxInclusive value="1000000000000000" />
<xs:minInclusive value="-1000000000000000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="B">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,16}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="18" />
<xs:maxInclusive value="10000000000000000" />
<xs:minInclusive value="-10000000000000000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="C">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="999999.99" />
<xs:minInclusive value="0.01" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="D">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="9999.99" />
<xs:minInclusive value="0" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="E">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:pattern value="(-)?\d{1,9}\.\d{2}" />
<xs:fractionDigits value="2" />
<xs:totalDigits value="11" />
<xs:maxInclusive value="999999999.99" />
<xs:minInclusive value="-999999999.99" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="F">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="36" />
<xs:maxLength value="36" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="G">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="978" />
<xs:enumeration value="000" />
<xs:enumeration value="978" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Generated XML 1:
<?xml version="1.0"?>
<p1:Type xmlns:p1="Schemas/Typ9002/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Schemas/Typ9002/1.0 file:///c:/AUTOMATION/VerarbeitungsSet/_issues/Issues.xsd">
<p1:StandardData>
<p1:A>-1000000000000000</p1:A>
<p1:B>-10000000000000000</p1:B>
<p1:C>0.01</p1:C>
<p1:D>0</p1:D>
<p1:E>-999999999.99</p1:E>
<p1:F>stringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p1:F>
<p1:G>978</p1:G>
</p1:StandardData>
</p1:Type>



Sample XSD 2:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="Schemas/Typ9002/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="Schemas/Typ9002/1.0" elementFormDefault="qualified">
<xs:element name="Type">
<xs:complexType>
<xs:sequence>
<xs:element name="StandardData">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="18"/>
<xs:maxInclusive value="1000000000000000"/>
<xs:minInclusive value="-1000000000000000"/>
<xs:pattern value="(-)?\d{1,16}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="B">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="18"/>
<xs:maxInclusive value="10000000000000000"/>
<xs:minInclusive value="-10000000000000000"/>
<xs:pattern value="(-)?\d{1,16}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="C">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="999999.99"/>
<xs:minInclusive value="0.01"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="D">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="9999.99"/>
<xs:minInclusive value="0"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="E">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="11"/>
<xs:maxInclusive value="999999999.99"/>
<xs:minInclusive value="-999999999.99"/>
<xs:pattern value="(-)?\d{1,9}\.\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="F">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="36"/>
<xs:maxLength value="36"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="G" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="978"/>
<xs:enumeration value="000"/>
<xs:enumeration value="978"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Generated XML 2:
<?xml version="1.0"?>
<p1:Type xmlns:p1="Schemas/Typ9002/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Schemas/Typ9002/1.0 file:///c:/AUTOMATION/VerarbeitungsSet/_issues/Issues_2.xsd">
<p1:StandardData>
<p1:A>-1.23</p1:A>
<p1:B>-1.23</p1:B>
<p1:C>-1.23</p1:C>
<p1:D>-1.23</p1:D>
<p1:E>-1.23</p1:E>
<p1:F>stringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p1:F>
<p1:G>978</p1:G>
</p1:StandardData>
</p1:Type>

Postnext
Tony LavinioSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Tony Lavinio
Date: 10 Jan 2006 08:53 AM
Thank you for the testcases. We'll take a look right away.

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Bruno F
Date: 17 Jan 2006 10:07 AM
Hi Tony,

hopefully you found the input helpful.
will there be an update to the XML instance generation?
That functionality was the main reason we bought StylusStudio... on my recommendation, since its already doing better on regular expressions than *thenamethatmaynotbespoken* :)

Kind regards,
Bruno

Postnext
Tony LavinioSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Tony Lavinio
Date: 17 Jan 2006 11:28 AM
First, the spec says we can add as many zeros as we want.
But we want to be nice and play well with others, to we
try to generate the same number as the totalDigits=.

In your case, there was a very interesting interaction going
on. When we generated the sample number, you asked for 13
digits. The datatype was integer, and the largest positive
value that an integer can hold is 12 digits. If you go bigger,
you wrap (due to twos-complements math) to negatives. And
that's what happened. The internal function saw that the output
was 13 characters (12 digits plus the '-') and formatted the
output field to 13 spaces.

The good news is that this will be changed in the next release.
The bad news is that since we are well within the explicit text
of the specification, this will not be backported into a patch
for the current release.

Does this help at all?

Postnext
Bruno FSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Bruno F
Date: 17 Jan 2006 11:42 AM
So you're saying no patch to StylusStudio Professional 2006 considering the "too much zeroes" issues. This one is minor...I can live with it :)

But what about the two sample XSDs and the related issues? StylusStudio isnt producing valid XML for these... this might be a more serious gap in functionality (not to say a bug). I'd call it the "multiple restriction facets" issue.
Or am I off-topic here and we should move the discussion somewhere else *g*.

Regards,
Bruno

Posttop
Tony LavinioSubject: Unwanted blanks in XML schema / XSD to XML conversion (padding)
Author: Tony Lavinio
Date: 17 Jan 2006 02:42 PM
It turns out that there is no algorithm that will guarantee that the
generated XML will match the schema that will run in predictable time.

Our algorithm is highly tuned, but unless we start writing all sorts
of special-case code for specific situations, it's unlikely that it
will improve to the point where we can guarantee that for any valid
XSD we will generate a perfectly valid XML file. We're also pretty
sure that no one else can guarantee it in all cases.

We are proud of the generator we have; we feel it's about as good as
we or anyone else is likely to make in general (there may be specific
cases where another works better).

Just as a simple example, it doesn't take too much effort to build a
regular expression pattern facet that will take hours of iteration to
build a string that will pass.

There comes a point where nothing beats a sample of real data, and you
are probably right at that point.

Sorry we couldn't do more; at least the padding issue will be solved
in the next release (although I still do not admit guilt there ;) ).

   
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.