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
Bruno FSubject: XSD to XML - namespace "p1" generation
Author: Bruno F
Date: 19 Sep 2005 08:27 AM
Hi,

generating XML from XSD works just fine, except for the individual namespace that is created for the new XML file.


Example XSD file (truncated):
<xs:schema xmlns="Abcd/Schemas/Agb/1101/20050317/1.0" elementFormDefault="qualified" targetNamespace="Abcd/Schemas/Agb/1101/20050317/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
...


Generated XML file (truncated):
<?xml version="1.0"?>
<p1:Vga xmlns:p1="Abcd/Schemas/Agb/1101/20050317/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Abcd/Schemas/Agb/1101/20050317/1.0 file:///c:/_test/regEx_test.xsd">
<!--Element p1:Text1 is optional-->
<p1:Text1>
...



Is it possible to:
1) avoid creation of the "p1" (or "p2" etc...) namespace and the usage of that namespace for all XML elements?
2) avoid creation of the "schemaLocation" attribute?


Thanks in advance,
kind regards,

Bruno

Posttop
Alberto MassariSubject: XSD to XML - namespace
Author: Alberto Massari
Date: 20 Sep 2005 05:27 AM
Hi Bruno,

>Is it possible to:
>1) avoid creation of the "p1" (or "p2" etc...) namespace and the usage of that namespace for all XML elements?

The schema that you specify requires that the XML elements have a namespace associated; in some cases they can use a default namespace, for example

<Vga xmlns="Abcd/Schemas/Agb/1101/20050317/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="Abcd/Schemas/Agb/1101/20050317/1.0 file:///c:/_test/regEx_test.xsd">
<!--Element Text1 is optional-->
<Text1>
...

but this generates problems when a schema defines mixed elements (some in a namespace, some in another, some even in the empty namespace), so we chose not to use the default namespace

>2) avoid creation of the "schemaLocation" attribute?

If that attribute is missing, the XML is not bound to the schema used to create it, and cannot be validated.

Can I ask you why do you think you need no prefix and no schemaLocation attribute?

Alberto

 
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.