Home » Archived » XML Schema Definition (XSD) » "xmlns" in the <schema> element
"xmlns" in the <schema> element [message #11743] |
Sat, 01 March 2003 09:43  |
Eclipse User |
|
|
|
Originally posted by: paechoi.earthlink.net
When I tried to create a schema that contains only the plain <schema>
element without
any attribute, I don't see how to do it at this moment with Eclipse/XSD. The
following
code snippet shows the schema as follows:
// ####################### CODE SNIPPET #########################
public class XMLSchemaDemo {
/** Save the schema */
private void saveXMLSchema(XSDSchema xmlSchema, String
xmlSchemaURIToSave) {
try {
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = new
XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
resource.getContents().add(xmlSchema);
resourceSet.getResources().add(resource);
resource.save(Collections.EMPTY_MAP);
} catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
ex.printStackTrace();
}
}
/** doIt -- the initial method */
private void doIt() {
XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
System.out.println(xmlSchema);
saveXMLSchema(xmlSchema, "./test-xsd.xsd");
}
/** main - the main entry */
public static void main(String[] args) {
XMLSchemaDemo app = new XMLSchemaDemo ();
app.doIt();
}
}
// ####################### Print Out #############################
org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document: null,
schemaLocation: null, targetNamespace: null, attributeFormDefault: <unset>,
elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
version: null)
As you can see the "element" is null same as others, but the *actual* output
is as follows:
//###################### Schema Output ##########################
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
In the XSDSchemaImpl class, there is a method called,
getQNamePrefixToNamespaceMap(),
which returns java.util.Map. But it returns 0 for its size. How can we make
an initial schema
as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
Any comments?
Pae
P.S.: This is not related to the validation nor well-formedness so that no
comment
needed for that.
|
|
|
Re: "xmlns" in the <schema> element [message #11779 is a reply to message #11743] |
Mon, 03 March 2003 07:21   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
--------------C13E87430ADAEF8CCD184ED2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Pae,
You cannot create this serialization with the XSD model.
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
A schema with a null getSchemaForSchemaQNamePrefix and a
getQNamePrefixToNamespaceMap that maps null to null will serialize to this
syntactically equivalent form:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
Pae Choi wrote:
> When I tried to create a schema that contains only the plain <schema>
> element without
> any attribute, I don't see how to do it at this moment with Eclipse/XSD. The
> following
> code snippet shows the schema as follows:
>
> // ####################### CODE SNIPPET #########################
> public class XMLSchemaDemo {
>
> /** Save the schema */
> private void saveXMLSchema(XSDSchema xmlSchema, String
> xmlSchemaURIToSave) {
> try {
> ResourceSet resourceSet = new ResourceSetImpl();
> Resource resource = new
> XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
> resource.getContents().add(xmlSchema);
> resourceSet.getResources().add(resource);
> resource.save(Collections.EMPTY_MAP);
> } catch (Exception ex) {
> System.out.println(ex.getLocalizedMessage());
> ex.printStackTrace();
> }
> }
>
> /** doIt -- the initial method */
> private void doIt() {
> XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
>
> System.out.println(xmlSchema);
> saveXMLSchema(xmlSchema, "./test-xsd.xsd");
> }
>
> /** main - the main entry */
> public static void main(String[] args) {
> XMLSchemaDemo app = new XMLSchemaDemo ();
> app.doIt();
> }
> }
>
> // ####################### Print Out #############################
> org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document: null,
> schemaLocation: null, targetNamespace: null, attributeFormDefault: <unset>,
> elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
> version: null)
>
> As you can see the "element" is null same as others, but the *actual* output
> is as follows:
>
> //###################### Schema Output ##########################
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns=""/>
>
> In the XSDSchemaImpl class, there is a method called,
> getQNamePrefixToNamespaceMap(),
> which returns java.util.Map. But it returns 0 for its size. How can we make
> an initial schema
> as follows:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema/>
>
> Any comments?
>
> Pae
>
> P.S.: This is not related to the validation nor well-formedness so that no
> comment
> needed for that.
--------------C13E87430ADAEF8CCD184ED2
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Pae,
<p>You cannot create this serialization with the XSD model.
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><schema/></blockquote>
A schema with a null getSchemaForSchemaQNamePrefix and a getQNamePrefixToNamespaceMap
that maps null to null will serialize to this syntactically equivalent
form:
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><schema xmlns=""/></blockquote>
<p><br>Pae Choi wrote:
<blockquote TYPE=CITE>When I tried to create a schema that contains only
the plain <schema>
<br>element without
<br>any attribute, I don't see how to do it at this moment with Eclipse/XSD.
The
<br>following
<br>code snippet shows the schema as follows:
<p>// ####################### CODE SNIPPET #########################
<br>public class XMLSchemaDemo {
<p> /** Save the schema */
<br> private void saveXMLSchema(XSDSchema xmlSchema,
String
<br>xmlSchemaURIToSave) {
<br> try {
<br>
ResourceSet resourceSet = new ResourceSetImpl();
<br>
Resource resource = new
<br>XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
<br>
resource.getContents().add(xmlSchema);
<br>
resourceSet.getResources().add(resource);
<br>
resource.save(Collections.EMPTY_MAP);
<br> } catch (Exception ex) {
<br>
System.out.println(ex.getLocalizedMessage());
<br>
ex.printStackTrace();
<br> }
<br> }
<p> /** doIt -- the initial method */
<br> private void doIt() {
<br> XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
<p> System.out.println(xmlSchema);
<br> saveXMLSchema(xmlSchema,
"./test-xsd.xsd");
<br> }
<p> /** main - the main entry */
<br> public static void main(String[] args) {
<br> XMLSchemaDemo app = new
XMLSchemaDemo ();
<br> app.doIt();
<br> }
<br>}
<p>// ####################### Print Out #############################
<br>org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document:
null,
<br>schemaLocation: null, targetNamespace: null, attributeFormDefault:
<unset>,
<br>elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
<br>version: null)
<p>As you can see the "element" is null same as others, but the *actual*
output
<br>is as follows:
<p>//###################### Schema Output ##########################
<br><?xml version="1.0" encoding="UTF-8"?>
<br><schema xmlns=""/>
<p>In the XSDSchemaImpl class, there is a method called,
<br>getQNamePrefixToNamespaceMap(),
<br>which returns java.util.Map. But it returns 0 for its size. How can
we make
<br>an initial schema
<br>as follows:
<p><?xml version="1.0" encoding="UTF-8"?>
<br><schema/>
<p>Any comments?
<p>Pae
<p>P.S.: This is not related to the validation nor well-formedness so that
no
<br>comment
<br>needed for that.</blockquote>
</html>
--------------C13E87430ADAEF8CCD184ED2--
|
|
|
Re: "xmlns" in the <schema> element [message #13486 is a reply to message #11779] |
Tue, 04 March 2003 12:42  |
Eclipse User |
|
|
|
Originally posted by: paechoi.earthlink.net
Ed,
Thanks. That's all I need to know. I will find a workaround for my specific
need.
Regards,
Pae
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3E6348D1.ED831EE7@ca.ibm.com...
Pae,
You cannot create this serialization with the XSD model.
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
A schema with a null getSchemaForSchemaQNamePrefix and a
getQNamePrefixToNamespaceMap that maps null to null will serialize to this
syntactically equivalent form:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
Pae Choi wrote:
When I tried to create a schema that contains only the plain <schema>
element without
any attribute, I don't see how to do it at this moment with Eclipse/XSD. The
following
code snippet shows the schema as follows:
// ####################### CODE SNIPPET #########################
public class XMLSchemaDemo {
/** Save the schema */
private void saveXMLSchema(XSDSchema xmlSchema, String
xmlSchemaURIToSave) {
try {
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = new
XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
resource.getContents().add(xmlSchema);
resourceSet.getResources().add(resource);
resource.save(Collections.EMPTY_MAP);
} catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
ex.printStackTrace();
}
}
/** doIt -- the initial method */
private void doIt() {
XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
System.out.println(xmlSchema);
saveXMLSchema(xmlSchema, "./test-xsd.xsd");
}
/** main - the main entry */
public static void main(String[] args) {
XMLSchemaDemo app = new XMLSchemaDemo ();
app.doIt();
}
}
// ####################### Print Out #############################
org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document: null,
schemaLocation: null, targetNamespace: null, attributeFormDefault: <unset>,
elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
version: null)
As you can see the "element" is null same as others, but the *actual* output
is as follows:
//###################### Schema Output ##########################
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
In the XSDSchemaImpl class, there is a method called,
getQNamePrefixToNamespaceMap(),
which returns java.util.Map. But it returns 0 for its size. How can we make
an initial schema
as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
Any comments?
Pae
P.S.: This is not related to the validation nor well-formedness so that no
comment
needed for that.
|
|
|
Re: "xmlns" in the <schema> element [message #565524 is a reply to message #11743] |
Mon, 03 March 2003 07:21  |
Eclipse User |
|
|
|
--------------C13E87430ADAEF8CCD184ED2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Pae,
You cannot create this serialization with the XSD model.
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
A schema with a null getSchemaForSchemaQNamePrefix and a
getQNamePrefixToNamespaceMap that maps null to null will serialize to this
syntactically equivalent form:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
Pae Choi wrote:
> When I tried to create a schema that contains only the plain <schema>
> element without
> any attribute, I don't see how to do it at this moment with Eclipse/XSD. The
> following
> code snippet shows the schema as follows:
>
> // ####################### CODE SNIPPET #########################
> public class XMLSchemaDemo {
>
> /** Save the schema */
> private void saveXMLSchema(XSDSchema xmlSchema, String
> xmlSchemaURIToSave) {
> try {
> ResourceSet resourceSet = new ResourceSetImpl();
> Resource resource = new
> XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
> resource.getContents().add(xmlSchema);
> resourceSet.getResources().add(resource);
> resource.save(Collections.EMPTY_MAP);
> } catch (Exception ex) {
> System.out.println(ex.getLocalizedMessage());
> ex.printStackTrace();
> }
> }
>
> /** doIt -- the initial method */
> private void doIt() {
> XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
>
> System.out.println(xmlSchema);
> saveXMLSchema(xmlSchema, "./test-xsd.xsd");
> }
>
> /** main - the main entry */
> public static void main(String[] args) {
> XMLSchemaDemo app = new XMLSchemaDemo ();
> app.doIt();
> }
> }
>
> // ####################### Print Out #############################
> org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document: null,
> schemaLocation: null, targetNamespace: null, attributeFormDefault: <unset>,
> elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
> version: null)
>
> As you can see the "element" is null same as others, but the *actual* output
> is as follows:
>
> //###################### Schema Output ##########################
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns=""/>
>
> In the XSDSchemaImpl class, there is a method called,
> getQNamePrefixToNamespaceMap(),
> which returns java.util.Map. But it returns 0 for its size. How can we make
> an initial schema
> as follows:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema/>
>
> Any comments?
>
> Pae
>
> P.S.: This is not related to the validation nor well-formedness so that no
> comment
> needed for that.
--------------C13E87430ADAEF8CCD184ED2
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Pae,
<p>You cannot create this serialization with the XSD model.
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><schema/></blockquote>
A schema with a null getSchemaForSchemaQNamePrefix and a getQNamePrefixToNamespaceMap
that maps null to null will serialize to this syntactically equivalent
form:
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><schema xmlns=""/></blockquote>
<p><br>Pae Choi wrote:
<blockquote TYPE=CITE>When I tried to create a schema that contains only
the plain <schema>
<br>element without
<br>any attribute, I don't see how to do it at this moment with Eclipse/XSD.
The
<br>following
<br>code snippet shows the schema as follows:
<p>// ####################### CODE SNIPPET #########################
<br>public class XMLSchemaDemo {
<p> /** Save the schema */
<br> private void saveXMLSchema(XSDSchema xmlSchema,
String
<br>xmlSchemaURIToSave) {
<br> try {
<br>
ResourceSet resourceSet = new ResourceSetImpl();
<br>
Resource resource = new
<br>XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
<br>
resource.getContents().add(xmlSchema);
<br>
resourceSet.getResources().add(resource);
<br>
resource.save(Collections.EMPTY_MAP);
<br> } catch (Exception ex) {
<br>
System.out.println(ex.getLocalizedMessage());
<br>
ex.printStackTrace();
<br> }
<br> }
<p> /** doIt -- the initial method */
<br> private void doIt() {
<br> XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
<p> System.out.println(xmlSchema);
<br> saveXMLSchema(xmlSchema,
"./test-xsd.xsd");
<br> }
<p> /** main - the main entry */
<br> public static void main(String[] args) {
<br> XMLSchemaDemo app = new
XMLSchemaDemo ();
<br> app.doIt();
<br> }
<br>}
<p>// ####################### Print Out #############################
<br>org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document:
null,
<br>schemaLocation: null, targetNamespace: null, attributeFormDefault:
<unset>,
<br>elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
<br>version: null)
<p>As you can see the "element" is null same as others, but the *actual*
output
<br>is as follows:
<p>//###################### Schema Output ##########################
<br><?xml version="1.0" encoding="UTF-8"?>
<br><schema xmlns=""/>
<p>In the XSDSchemaImpl class, there is a method called,
<br>getQNamePrefixToNamespaceMap(),
<br>which returns java.util.Map. But it returns 0 for its size. How can
we make
<br>an initial schema
<br>as follows:
<p><?xml version="1.0" encoding="UTF-8"?>
<br><schema/>
<p>Any comments?
<p>Pae
<p>P.S.: This is not related to the validation nor well-formedness so that
no
<br>comment
<br>needed for that.</blockquote>
</html>
--------------C13E87430ADAEF8CCD184ED2--
|
|
|
Re: "xmlns" in the <schema> element [message #565832 is a reply to message #11779] |
Tue, 04 March 2003 12:42  |
Eclipse User |
|
|
|
Originally posted by: paechoi.earthlink.net
Ed,
Thanks. That's all I need to know. I will find a workaround for my specific
need.
Regards,
Pae
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3E6348D1.ED831EE7@ca.ibm.com...
Pae,
You cannot create this serialization with the XSD model.
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
A schema with a null getSchemaForSchemaQNamePrefix and a
getQNamePrefixToNamespaceMap that maps null to null will serialize to this
syntactically equivalent form:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
Pae Choi wrote:
When I tried to create a schema that contains only the plain <schema>
element without
any attribute, I don't see how to do it at this moment with Eclipse/XSD. The
following
code snippet shows the schema as follows:
// ####################### CODE SNIPPET #########################
public class XMLSchemaDemo {
/** Save the schema */
private void saveXMLSchema(XSDSchema xmlSchema, String
xmlSchemaURIToSave) {
try {
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = new
XSDResourceImpl(URI.createDeviceURI(xmlSchemaURIToSave));
resource.getContents().add(xmlSchema);
resourceSet.getResources().add(resource);
resource.save(Collections.EMPTY_MAP);
} catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
ex.printStackTrace();
}
}
/** doIt -- the initial method */
private void doIt() {
XSDSchema xmlSchema = XSDFactory.eINSTANCE.createXSDSchema();
System.out.println(xmlSchema);
saveXMLSchema(xmlSchema, "./test-xsd.xsd");
}
/** main - the main entry */
public static void main(String[] args) {
XMLSchemaDemo app = new XMLSchemaDemo ();
app.doIt();
}
}
// ####################### Print Out #############################
org.eclipse.xsd.impl.XSDSchemaImpl@276af2 (element: null) (document: null,
schemaLocation: null, targetNamespace: null, attributeFormDefault: <unset>,
elementFormDefault: <unset>, finalDefault: null, blockDefault: null,
version: null)
As you can see the "element" is null same as others, but the *actual* output
is as follows:
//###################### Schema Output ##########################
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""/>
In the XSDSchemaImpl class, there is a method called,
getQNamePrefixToNamespaceMap(),
which returns java.util.Map. But it returns 0 for its size. How can we make
an initial schema
as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema/>
Any comments?
Pae
P.S.: This is not related to the validation nor well-formedness so that no
comment
needed for that.
|
|
|
Goto Forum:
Current Time: Fri May 09 20:14:55 EDT 2025
Powered by FUDForum. Page generated in 0.04397 seconds
|