Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xsd-dev] "xmlns" in the <schema> element

Ed,

I do not wish to drag this thread to the irrelevant topic than
what I was asking for.

When you write a XML or its schema sometimes you need to
save it for the time being whether it is the valid stage or not.

Is that so hard to get a simple answer or suggestion for a
simple question?


Pae


> Pae,
>
> Are you saying you don't have access to newgroups:
>
>    news://news.eclipse.org/eclipse.technology.xsd
>

No. I don't and I thought you meaning a separate mailing
list like this.

> I'm not sure I understand what you are asking.  This XML
>
> >    <?xml version="1.0" encoding="UTF-8"?>
> >    <schema/>
>
> and this
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <schema xmlns=""/>
>
> both mean the same thing and neither are a valid representation of a
> schema.  Similarly, an empty QName prefix map, verses a map containing a
> single entry that maps null to "" both mean the same thing, and both
> represent an incomplete state.  Whether the XSD model produces one
> syntactically invalid form verses another equivalent syntactically invalid
> form seems irrelevant; neither is useful and neither can be used to
> construct a valid schema when subsequently read by a schema aware
> processor.
>
> The fundamental point is that the XSD model will help you build a valid
> schema; it won't be so helpful about building an invalid one.  To have a
> valid schema, you need to choose a valid schema for schema namespace, this
> applies both in the XSD model and in an XML serialization of a schema.
>
>
> Ed Merks/Toronto/IBM@IBMCA
> mailto: merks@xxxxxxxxxx
> 905-413-3265  (t/l 969)
>
>
>
>
>
>                       "Pae Choi"
>                       <paechoi@earthlin        To:
<xsd-dev@xxxxxxxxxxx>
>                       k.net>                   cc:
<xsd-dev@xxxxxxxxxxx>, <xsd-dev-admin@xxxxxxxxxxx>
>                       Sent by:                 Subject:  Re: [xsd-dev]
"xmlns" in the <schema> element
>                       xsd-dev-admin@ecl
>                       ipse.org
>
>
>                       02/28/2003 07:47
>                       AM
>                       Please respond to
>                       xsd-dev
>
>
>
>
>
> Ed,
>
> I understand the content of schema was not valid, but that was not
> what I asked for. And I've been developing the schema in hand
> sufficient to understand whether they are valid or not.
>
> The schema will be built in a valid format eventually, but here I am
> trying to build it a piece by piece.
>
> Again, the question is whetehr there is a proper way and/or any
> workaround to do so or not. Thanks
>
> Any more comments?
>
>
> Pae
>
>
> P.S.: Also, if the getQNamePrefixToNamespaceMap()  return a Map
> which contains the size, 0, and shows the element is null. But the
> result schema file contains as I enclosed in the previous message.
> Shouldn't we call it a bug unless we call it a feature.
>
> P.P.S: I would try the USER list to post the original message if it
> was available, but this DEV list is only one avaialbe at [1].
>
> [1] http://www.eclipse.org/mail/index.html
>
>
>
> > Pae,
> >
> > This isn't a valid schema:
> >
> >    <?xml version="1.0" encoding="UTF-8"?>
> >    <schema/>
> >
> > You minimally need to choose the schema for schema namespace
> >
> >    xmlSchema.getQNamePrefixToNamespaceMap().put(null,
> >    XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
> >
> > Which would give this minimally correct result:
> >
> >    <?xml version="1.0" encoding="UTF-8"?>
> >    <schema xmlns="http://www.w3.org/2001/XMLSchema"/>
> >
> > Such a schema will need to have a target namespace because the null
> target
> > namespace won't be accessible (because the null prefix is used up) so
> it's
> > usually best to choose a prefix for the schema for schema namespace:
> >
> >    xmlSchema.setSchemaForSchemaQNamePrefix("xsd");
> >    xmlSchema.getQNamePrefixToNamespaceMap().put("xsd",
> >    XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
> >
> > Which would give this result:
> >
> >    <?xml version="1.0" encoding="UTF-8"?>
> >    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
> >
> > PS, these kinds of questions are better to be asked on the forum so that
> > new users will benefit from the answers.
> >
> >
> > Ed Merks/Toronto/IBM@IBMCA
> > mailto: merks@xxxxxxxxxx
> > 905-413-3265  (t/l 969)
> >
> >
> >
> >
> >
> >                       "Pae Choi"
> >                       <paechoi@earthlin        To:
> <xsd-dev@xxxxxxxxxxx>
> >                       k.net>                   cc:
> >                       Sent by:                 Subject:  [xsd-dev]
> "xmlns"
> in the <schema> element
> >                       xsd-dev-admin@ecl
> >                       ipse.org
> >
> >
> >                       02/28/2003 07:04
> >                       AM
> >                       Please respond to
> >                       xsd-dev
> >
> >
> >
> >
> >
> > When I tried to create a schema that contains only the <schema> element
> > without any
> > attribute, I don't see how to do it at this moment. The following code
> > snippet shows the
> > schema as follows:
> >
> > <?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 should I
> or
> > make a workaround
> > to produce the output as:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <schema/>
> >
> > Any comments?
> >
> >
> > Pae
> >
> >
> > // ####################### 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("XML Schema: [\n" + xmlSchema + "]");
> >         saveXMLSchema(xmlSchema, "./test-xsd.xsd");
> >     }
> >
> >     /** main - the main entry */
> >     public static void main(String[] args) {
> >         XMLSchemaDemo app = new XMLSchemaDemo ();
> >         app.doIt();
> >     }
> > }
> >
> >
> > _______________________________________________
> > xsd-dev mailing list
> > xsd-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/xsd-dev
>
> _______________________________________________
> xsd-dev mailing list
> xsd-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/xsd-dev
>
>
>
> _______________________________________________
> xsd-dev mailing list
> xsd-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/xsd-dev



Back to the top