You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Matthew Peters (JIRA)" <tu...@ws.apache.org> on 2007/04/24 18:48:15 UTC

[jira] Created: (TUSCANY-1231) Various incorrect namespaces in generated XML

Various incorrect namespaces in generated XML
---------------------------------------------

                 Key: TUSCANY-1231
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1231
             Project: Tuscany
          Issue Type: Bug
          Components: C++ DAS
    Affects Versions: Cpp-M3
         Environment: WinXP
            Reporter: Matthew Peters


Given the following two xsds, which define an add element in http://Component and a PersonType in http://www.test.com/info...

<?php
$xmldas = SDO_DAS_XML::create('types.xsd');
$person =
$xmldas->createDataObject('http://www.test.com/info','personType');
$name = $person->createDataObject('name');
$name->first = "Will";
$name->last  = "Shakespeare";
$add = $xmldas->createDataObject('http://Component','add');
$add->person = $person;
$xdoc   = $xmldas->createDocument('', 'BOGUS', $add);
$xmlstr = $xmldas->saveString($xdoc, 2);
echo $xmlstr;
?>

types.xsd:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      xmlns:ns0="http://www.test.com/info"
      targetNamespace="http://Component"
      elementNameDefault="qualified">
      <xs:import schemaLocation="person.xsd"
namespace="http://www.test.com/info"/>
      <xs:element name="add">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="person" type="ns0:personType"
nillable="true"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

person.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" 
    targetNamespace="http://www.test.com/info" 
    xmlns:info="http://www.test.com/info">
    <complexType name="nameType">
		<sequence>
			<element name="first" type="string"></element>
			<element name="last" type="string"></element>
		</sequence>
	</complexType>
	<complexType name="personType">
		<sequence>
			<element name="name" type="info:nameType"></element>
		</sequence>
	</complexType>	
</schema>

... if you now create a document with an 'add' element, create a PersonType object and assign meaningful first and last names, and serialise to XML, you get:

<?xml version="1.0" encoding="UTF-8"?>
<add xmlns="http://Component" xmlns:tns="http://Component" xmlns:tns2="http://www.test.com/info" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <person>
    <tns2:name>
      <first>Will</first>
      <last>Shakespeare</last>
    </tns2:name>
  </person>
</add>

There are several things wrong with this XML. 

1. "name" should not be in tns2=http://www.test.com/info, and neither should "first" and "last" be in the default namespace of http://Component. The person.xsd has no elementFormDefault, so the elements below <person> should all be in the no name namespace. 
2.You have to change the person.xsd to see the next thing: put ElementNameDefault="qualified" in
the person schema, then "name", "first" and "last" should all now be
coming out in the http://www.test.com/info namespace, but it makes no
difference to the generated XML. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Closed: (TUSCANY-1231) Various incorrect namespaces in generated XML

Posted by "Matthew Peters (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Peters closed TUSCANY-1231.
-----------------------------------

    Resolution: Duplicate

Raised in error - I had mislaid the earlier TUSCANY-1112

> Various incorrect namespaces in generated XML
> ---------------------------------------------
>
>                 Key: TUSCANY-1231
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1231
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-M3
>         Environment: WinXP
>            Reporter: Matthew Peters
>
> Given the following two xsds, which define an add element in http://Component and a PersonType in http://www.test.com/info...
> <?php
> $xmldas = SDO_DAS_XML::create('types.xsd');
> $person =
> $xmldas->createDataObject('http://www.test.com/info','personType');
> $name = $person->createDataObject('name');
> $name->first = "Will";
> $name->last  = "Shakespeare";
> $add = $xmldas->createDataObject('http://Component','add');
> $add->person = $person;
> $xdoc   = $xmldas->createDocument('', 'BOGUS', $add);
> $xmlstr = $xmldas->saveString($xdoc, 2);
> echo $xmlstr;
> ?>
> types.xsd:
>     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>       xmlns:ns0="http://www.test.com/info"
>       targetNamespace="http://Component"
>       elementNameDefault="qualified">
>       <xs:import schemaLocation="person.xsd"
> namespace="http://www.test.com/info"/>
>       <xs:element name="add">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="person" type="ns0:personType"
> nillable="true"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>     </xs:schema>
> person.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" 
>     targetNamespace="http://www.test.com/info" 
>     xmlns:info="http://www.test.com/info">
>     <complexType name="nameType">
> 		<sequence>
> 			<element name="first" type="string"></element>
> 			<element name="last" type="string"></element>
> 		</sequence>
> 	</complexType>
> 	<complexType name="personType">
> 		<sequence>
> 			<element name="name" type="info:nameType"></element>
> 		</sequence>
> 	</complexType>	
> </schema>
> ... if you now create a document with an 'add' element, create a PersonType object and assign meaningful first and last names, and serialise to XML, you get:
> <?xml version="1.0" encoding="UTF-8"?>
> <add xmlns="http://Component" xmlns:tns="http://Component" xmlns:tns2="http://www.test.com/info" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <person>
>     <tns2:name>
>       <first>Will</first>
>       <last>Shakespeare</last>
>     </tns2:name>
>   </person>
> </add>
> There are several things wrong with this XML. 
> 1. "name" should not be in tns2=http://www.test.com/info, and neither should "first" and "last" be in the default namespace of http://Component. The person.xsd has no elementFormDefault, so the elements below <person> should all be in the no name namespace. 
> 2.You have to change the person.xsd to see the next thing: put ElementNameDefault="qualified" in
> the person schema, then "name", "first" and "last" should all now be
> coming out in the http://www.test.com/info namespace, but it makes no
> difference to the generated XML. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1231) Various incorrect namespaces in generated XML

Posted by "Caroline Maynard (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Caroline Maynard updated TUSCANY-1231:
--------------------------------------

    Component/s:     (was: C++ DAS)
                 C++ SDO

> Various incorrect namespaces in generated XML
> ---------------------------------------------
>
>                 Key: TUSCANY-1231
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1231
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-M3
>         Environment: WinXP
>            Reporter: Matthew Peters
>
> Given the following two xsds, which define an add element in http://Component and a PersonType in http://www.test.com/info...
> <?php
> $xmldas = SDO_DAS_XML::create('types.xsd');
> $person =
> $xmldas->createDataObject('http://www.test.com/info','personType');
> $name = $person->createDataObject('name');
> $name->first = "Will";
> $name->last  = "Shakespeare";
> $add = $xmldas->createDataObject('http://Component','add');
> $add->person = $person;
> $xdoc   = $xmldas->createDocument('', 'BOGUS', $add);
> $xmlstr = $xmldas->saveString($xdoc, 2);
> echo $xmlstr;
> ?>
> types.xsd:
>     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>       xmlns:ns0="http://www.test.com/info"
>       targetNamespace="http://Component"
>       elementNameDefault="qualified">
>       <xs:import schemaLocation="person.xsd"
> namespace="http://www.test.com/info"/>
>       <xs:element name="add">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="person" type="ns0:personType"
> nillable="true"/>
>           </xs:sequence>
>         </xs:complexType>
>       </xs:element>
>     </xs:schema>
> person.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" 
>     targetNamespace="http://www.test.com/info" 
>     xmlns:info="http://www.test.com/info">
>     <complexType name="nameType">
> 		<sequence>
> 			<element name="first" type="string"></element>
> 			<element name="last" type="string"></element>
> 		</sequence>
> 	</complexType>
> 	<complexType name="personType">
> 		<sequence>
> 			<element name="name" type="info:nameType"></element>
> 		</sequence>
> 	</complexType>	
> </schema>
> ... if you now create a document with an 'add' element, create a PersonType object and assign meaningful first and last names, and serialise to XML, you get:
> <?xml version="1.0" encoding="UTF-8"?>
> <add xmlns="http://Component" xmlns:tns="http://Component" xmlns:tns2="http://www.test.com/info" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <person>
>     <tns2:name>
>       <first>Will</first>
>       <last>Shakespeare</last>
>     </tns2:name>
>   </person>
> </add>
> There are several things wrong with this XML. 
> 1. "name" should not be in tns2=http://www.test.com/info, and neither should "first" and "last" be in the default namespace of http://Component. The person.xsd has no elementFormDefault, so the elements below <person> should all be in the no name namespace. 
> 2.You have to change the person.xsd to see the next thing: put ElementNameDefault="qualified" in
> the person schema, then "name", "first" and "last" should all now be
> coming out in the http://www.test.com/info namespace, but it makes no
> difference to the generated XML. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org