Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » A Test with http://www.w3.org/2001/XMLSchema.xsd
A Test with http://www.w3.org/2001/XMLSchema.xsd [message #21189] Mon, 05 May 2003 10:38 Go to next message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

I have tested [1]the metaschema with my sample code(XSD v1.0.2
+ EMF v1.0.2). And it gets 15 diagnostics messages.

Any comments?


Pae

P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
v1.0.2 for now. :-(

[1] meataschema: http://www.w3.org/2001/XMLSchema.xsd


// ############## Diagnostic Messages #########
0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
not been resolved; Node = [xs:import]
1: At line #182(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
2: At line #183(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
3: At line #232(44), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
4: At line #833(59), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
5: At line #834(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
7: At line #841(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
8: At line #842(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
10: At line #1248(51), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
11: At line #2146(37), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
12: At line #2147(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
13: At line #2148(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
14: At line #2149(41), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
15: At line #2150(34), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]

// ############# Code Snippet ###############
/*
* EclipseXSDDemo2.java
*
* Created on May 2, 2003, 11:13 PM
*
*/

package org.paechoi.xsd.test;

// W3C/DOM
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
// Eclipse/XSD
import org.eclipse.xsd.util.XSDParser;
import org.eclipse.xsd.XSDFactory;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.impl.XSDSchemaImpl;
import org.eclipse.xsd.util.XSDResourceImpl;
import org.eclipse.xsd.util.XSDResourceFactoryImpl;
import org.eclipse.xsd.XSDDiagnostic;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.common.util.EList;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.FileNotFoundException;


/**
*
* @author pae
*/
public class EclipseXSDDemo2 {
// private Document xmlDOM = null;
private XSDParser xsdParser = null;

// instance initializer
{
//
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd", new
XSDResourceFactoryImpl());
}

/** Creates a new instance of EclipseXSDDemo2 */
public EclipseXSDDemo2() {
super();

// Redirect the System.err
try {
System.setErr(new PrintStream(new
FileOutputStream("errors.log", true)));
}
catch (FileNotFoundException fileNotFoundException) {
}
}

/** Open a XML DOM */
private Document openXMLDOM(String uri) {
// Create a factory object for creating DOM parsers
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
Document xmlDoc = null;

// Build a new DOM
try {
// Now use the factory to create a DOM parser (a.k.a. a
DocumentBuilder)
factory.setNamespaceAware(true);
builder = factory.newDocumentBuilder();
xmlDoc = builder.parse(uri);
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}

return xmlDoc;
}

/** Open a XML DOM using XSDParser */
private Document openXMLDOMUsingXSDParser(String uri) {
Document xmlDoc = null;

// Build a new DOM
try {
xsdParser = new XSDParser();
xsdParser.parse(uri);
xmlDoc = xsdParser.getDocument();
}
catch (Exception ex) {
ex.printStackTrace();
return null;
}

return xmlDoc;
}

/** doIt */
private void doIt() {
try {
// Document xmlDOM =
openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
// Document xmlDOM = openXMLDOMUsingXSDParser("./wsdl.xsd");
Document xmlDOM =
openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");

Element rootElement = xmlDOM.getDocumentElement();

XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
xsdSchema.setDocument(xmlDOM);
xsdSchema.setElement(rootElement);
xsdSchema.updateElement();

System.out.println("\n\n");
XSDResourceImpl.serialize(System.out, xsdSchema.getElement());

System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
>>>>>>>>>>>>>>>>>>>>>>>>>>");
xsdSchema.validate();
//EList eList = xsdMainSchema.getDiagnostics();
EList eList = xsdSchema.getAllDiagnostics();
for (int i = 0; i < eList.size(); i++) {
XSDDiagnostic xsdDiagnostic = (XSDDiagnostic)eList.get(i);
System.out.println(i + ": At line #" +
xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
xsdDiagnostic.getMessage() + "; Node = [" +
xsdDiagnostic.getNode().getNodeName() + "]");
}

System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
<<<<");
}
catch (Exception ex) {
ex.printStackTrace();
}
}

/** main - the main entry */
public static void main(String[] args) {
EclipseXSDDemo2 app = new EclipseXSDDemo2();
app.doIt();
}
}
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #21303 is a reply to message #21189] Mon, 05 May 2003 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
v2.0.2,
and the diagnostic message came out as follows:


// ############## Diagnostic Messages #################
0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
not been resolved; Node = [xs:import]
1: At line #182(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
2: At line #183(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
3: At line #232(44), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
4: At line #833(59), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
5: At line #834(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
7: At line #841(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
8: At line #842(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
10: At line #1248(51), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
11: At line #2146(37), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
12: At line #2147(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
13: At line #2148(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
14: At line #2149(41), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
15: At line #2150(34), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]

Any comments?


Pae



"Pae Choi" <paechoi@earthlink.net> wrote in message
news:b95eu0$376$1@rogue.oti.com...
> I have tested [1]the metaschema with my sample code(XSD v1.0.2
> + EMF v1.0.2). And it gets 15 diagnostics messages.
>
> Any comments?
>
>
> Pae
>
> P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> v1.0.2 for now. :-(
>
> [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
>
>
> // ############## Diagnostic Messages #########
> 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> not been resolved; Node = [xs:import]
> 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 3: At line #232(44), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> 10: At line #1248(51), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
>
> // ############# Code Snippet ###############
> /*
> * EclipseXSDDemo2.java
> *
> * Created on May 2, 2003, 11:13 PM
> *
> */
>
> package org.paechoi.xsd.test;
>
> // W3C/DOM
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.parsers.DocumentBuilder;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> // Eclipse/XSD
> import org.eclipse.xsd.util.XSDParser;
> import org.eclipse.xsd.XSDFactory;
> import org.eclipse.xsd.XSDSchema;
> import org.eclipse.xsd.impl.XSDSchemaImpl;
> import org.eclipse.xsd.util.XSDResourceImpl;
> import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> import org.eclipse.xsd.XSDDiagnostic;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.common.util.EList;
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.PrintStream;
> import java.io.FileNotFoundException;
>
>
> /**
> *
> * @author pae
> */
> public class EclipseXSDDemo2 {
> // private Document xmlDOM = null;
> private XSDParser xsdParser = null;
>
> // instance initializer
> {
> //
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
new
> XSDResourceFactoryImpl());
> }
>
> /** Creates a new instance of EclipseXSDDemo2 */
> public EclipseXSDDemo2() {
> super();
>
> // Redirect the System.err
> try {
> System.setErr(new PrintStream(new
> FileOutputStream("errors.log", true)));
> }
> catch (FileNotFoundException fileNotFoundException) {
> }
> }
>
> /** Open a XML DOM */
> private Document openXMLDOM(String uri) {
> // Create a factory object for creating DOM parsers
> DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance();
> DocumentBuilder builder = null;
> Document xmlDoc = null;
>
> // Build a new DOM
> try {
> // Now use the factory to create a DOM parser (a.k.a. a
> DocumentBuilder)
> factory.setNamespaceAware(true);
> builder = factory.newDocumentBuilder();
> xmlDoc = builder.parse(uri);
> }
> catch (Exception ex) {
> ex.printStackTrace();
> return null;
> }
>
> return xmlDoc;
> }
>
> /** Open a XML DOM using XSDParser */
> private Document openXMLDOMUsingXSDParser(String uri) {
> Document xmlDoc = null;
>
> // Build a new DOM
> try {
> xsdParser = new XSDParser();
> xsdParser.parse(uri);
> xmlDoc = xsdParser.getDocument();
> }
> catch (Exception ex) {
> ex.printStackTrace();
> return null;
> }
>
> return xmlDoc;
> }
>
> /** doIt */
> private void doIt() {
> try {
> // Document xmlDOM =
> openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> // Document xmlDOM = openXMLDOMUsingXSDParser("./wsdl.xsd");
> Document xmlDOM =
> openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
>
> Element rootElement = xmlDOM.getDocumentElement();
>
> XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> xsdSchema.setDocument(xmlDOM);
> xsdSchema.setElement(rootElement);
> xsdSchema.updateElement();
>
> System.out.println("\n\n");
> XSDResourceImpl.serialize(System.out, xsdSchema.getElement());
>
> System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> >>>>>>>>>>>>>>>>>>>>>>>>>>");
> xsdSchema.validate();
> //EList eList = xsdMainSchema.getDiagnostics();
> EList eList = xsdSchema.getAllDiagnostics();
> for (int i = 0; i < eList.size(); i++) {
> XSDDiagnostic xsdDiagnostic = (XSDDiagnostic)eList.get(i);
> System.out.println(i + ": At line #" +
> xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> xsdDiagnostic.getMessage() + "; Node = [" +
> xsdDiagnostic.getNode().getNodeName() + "]");
> }
>
>
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> <<<<");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> /** main - the main entry */
> public static void main(String[] args) {
> EclipseXSDDemo2 app = new EclipseXSDDemo2();
> app.doIt();
> }
> }
>
>
>
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #21312 is a reply to message #21303] Mon, 05 May 2003 15:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Pae,

This version of XMLSchema.xsd is different from the cached version in
plugins/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd, which doesn't have
these problems. I'm upgrading the cached version to this newer version, which
contains errata changes.

This newer version revealed a bug I hadn't noticed before and fixing it
eliminates the diagnostics below except for 1, 3, 10. These three remaining
diagnostics are caused by failure to resolve the XMLSchema.dtd in the DOCTYPE
tag in the xml.xsd, so I fixed the XSDParser to resolve the XMLSchema.dtd. With
these changes, the file validates without any diagnostics.

It may be a week or two before we drop a version 1.1.0 build with these fixes...



Pae Choi wrote:

> I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
> v2.0.2,
> and the diagnostic message came out as follows:
>
> // ############## Diagnostic Messages #################
> 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> not been resolved; Node = [xs:import]
> 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 3: At line #232(44), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
> 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
> 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
> 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
> 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> 10: At line #1248(51), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 11: At line #2146(37), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 12: At line #2147(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 13: At line #2148(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 14: At line #2149(41), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 15: At line #2150(34), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
>
> Any comments?
>
> Pae
>
> "Pae Choi" <paechoi@earthlink.net> wrote in message
> news:b95eu0$376$1@rogue.oti.com...
> > I have tested [1]the metaschema with my sample code(XSD v1.0.2
> > + EMF v1.0.2). And it gets 15 diagnostics messages.
> >
> > Any comments?
> >
> >
> > Pae
> >
> > P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> > v1.0.2 for now. :-(
> >
> > [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
> >
> >
> > // ############## Diagnostic Messages #########
> > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> > not been resolved; Node = [xs:import]
> > 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 3: At line #232(44), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> [xs:enumeration]
> > 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> [xs:enumeration]
> > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> [xs:enumeration]
> > 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> [xs:enumeration]
> > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > 10: At line #1248(51), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> >
> > // ############# Code Snippet ###############
> > /*
> > * EclipseXSDDemo2.java
> > *
> > * Created on May 2, 2003, 11:13 PM
> > *
> > */
> >
> > package org.paechoi.xsd.test;
> >
> > // W3C/DOM
> > import javax.xml.parsers.DocumentBuilderFactory;
> > import javax.xml.parsers.DocumentBuilder;
> > import org.w3c.dom.Document;
> > import org.w3c.dom.Element;
> > // Eclipse/XSD
> > import org.eclipse.xsd.util.XSDParser;
> > import org.eclipse.xsd.XSDFactory;
> > import org.eclipse.xsd.XSDSchema;
> > import org.eclipse.xsd.impl.XSDSchemaImpl;
> > import org.eclipse.xsd.util.XSDResourceImpl;
> > import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> > import org.eclipse.xsd.XSDDiagnostic;
> > import org.eclipse.emf.ecore.resource.Resource;
> > import org.eclipse.emf.ecore.resource.ResourceSet;
> > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > import org.eclipse.emf.common.util.EList;
> > import java.io.File;
> > import java.io.FileOutputStream;
> > import java.io.PrintStream;
> > import java.io.FileNotFoundException;
> >
> >
> > /**
> > *
> > * @author pae
> > */
> > public class EclipseXSDDemo2 {
> > // private Document xmlDOM = null;
> > private XSDParser xsdParser = null;
> >
> > // instance initializer
> > {
> > //
> > Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new
> > XSDResourceFactoryImpl());
> > }
> >
> > /** Creates a new instance of EclipseXSDDemo2 */
> > public EclipseXSDDemo2() {
> > super();
> >
> > // Redirect the System.err
> > try {
> > System.setErr(new PrintStream(new
> > FileOutputStream("errors.log", true)));
> > }
> > catch (FileNotFoundException fileNotFoundException) {
> > }
> > }
> >
> > /** Open a XML DOM */
> > private Document openXMLDOM(String uri) {
> > // Create a factory object for creating DOM parsers
> > DocumentBuilderFactory factory =
> > DocumentBuilderFactory.newInstance();
> > DocumentBuilder builder = null;
> > Document xmlDoc = null;
> >
> > // Build a new DOM
> > try {
> > // Now use the factory to create a DOM parser (a.k.a. a
> > DocumentBuilder)
> > factory.setNamespaceAware(true);
> > builder = factory.newDocumentBuilder();
> > xmlDoc = builder.parse(uri);
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > return null;
> > }
> >
> > return xmlDoc;
> > }
> >
> > /** Open a XML DOM using XSDParser */
> > private Document openXMLDOMUsingXSDParser(String uri) {
> > Document xmlDoc = null;
> >
> > // Build a new DOM
> > try {
> > xsdParser = new XSDParser();
> > xsdParser.parse(uri);
> > xmlDoc = xsdParser.getDocument();
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > return null;
> > }
> >
> > return xmlDoc;
> > }
> >
> > /** doIt */
> > private void doIt() {
> > try {
> > // Document xmlDOM =
> > openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> > // Document xmlDOM = openXMLDOMUsingXSDParser("./wsdl.xsd");
> > Document xmlDOM =
> > openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
> >
> > Element rootElement = xmlDOM.getDocumentElement();
> >
> > XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> > xsdSchema.setDocument(xmlDOM);
> > xsdSchema.setElement(rootElement);
> > xsdSchema.updateElement();
> >
> > System.out.println("\n\n");
> > XSDResourceImpl.serialize(System.out, xsdSchema.getElement());
> >
> > System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> > >>>>>>>>>>>>>>>>>>>>>>>>>>");
> > xsdSchema.validate();
> > //EList eList = xsdMainSchema.getDiagnostics();
> > EList eList = xsdSchema.getAllDiagnostics();
> > for (int i = 0; i < eList.size(); i++) {
> > XSDDiagnostic xsdDiagnostic = (XSDDiagnostic)eList.get(i);
> > System.out.println(i + ": At line #" +
> > xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> > xsdDiagnostic.getMessage() + "; Node = [" +
> > xsdDiagnostic.getNode().getNodeName() + "]");
> > }
> >
> >
> System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> > <<<<");
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > }
> > }
> >
> > /** main - the main entry */
> > public static void main(String[] args) {
> > EclipseXSDDemo2 app = new EclipseXSDDemo2();
> > app.doIt();
> > }
> > }
> >
> >
> >
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #21314 is a reply to message #21312] Mon, 05 May 2003 21:17 Go to previous message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

Ed,

Thank you for letting me know in detail. I'll look forward to seeing
your next quality work.

Best regards,


Pae

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3EB68637.F18DADB9@ca.ibm.com...
> Pae,
>
> This version of XMLSchema.xsd is different from the cached version in
> plugins/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd, which doesn't
have
> these problems. I'm upgrading the cached version to this newer version,
which
> contains errata changes.
>
> This newer version revealed a bug I hadn't noticed before and fixing it
> eliminates the diagnostics below except for 1, 3, 10. These three
remaining
> diagnostics are caused by failure to resolve the XMLSchema.dtd in the
DOCTYPE
> tag in the xml.xsd, so I fixed the XSDParser to resolve the XMLSchema.dtd.
With
> these changes, the file validates without any diagnostics.
>
> It may be a week or two before we drop a version 1.1.0 build with these
fixes...
>
>
>
> Pae Choi wrote:
>
> > I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
> > v2.0.2,
> > and the diagnostic message came out as follows:
> >
> > // ############## Diagnostic Messages #################
> > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd'
has
> > not been resolved; Node = [xs:import]
> > 1: At line #182(47), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 2: At line #183(39), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 3: At line #232(44), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 4: At line #833(59), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> > 5: At line #834(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be
one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > 7: At line #841(47), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> > 8: At line #842(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be
one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > 10: At line #1248(51), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> >
> > Any comments?
> >
> > Pae
> >
> > "Pae Choi" <paechoi@earthlink.net> wrote in message
> > news:b95eu0$376$1@rogue.oti.com...
> > > I have tested [1]the metaschema with my sample code(XSD v1.0.2
> > > + EMF v1.0.2). And it gets 15 diagnostics messages.
> > >
> > > Any comments?
> > >
> > >
> > > Pae
> > >
> > > P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> > > v1.0.2 for now. :-(
> > >
> > > [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
> > >
> > >
> > > // ############## Diagnostic Messages #########
> > > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd'
has
> > > not been resolved; Node = [xs:import]
> > > 1: At line #182(47), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 2: At line #183(39), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 3: At line #232(44), XSD: Attribute reference
> > > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > > [xs:attribute]
> > > 4: At line #833(59), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> > [xs:enumeration]
> > > 5: At line #834(42), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> > [xs:enumeration]
> > > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be
one
> > > of 0, 1 as constrained by
> > > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > > 7: At line #841(47), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> > [xs:enumeration]
> > > 8: At line #842(42), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> > [xs:enumeration]
> > > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be
one
> > > of 0, 1 as constrained by
> > > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > > 10: At line #1248(51), XSD: Attribute reference
> > > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > > [xs:attribute]
> > > 11: At line #2146(37), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 12: At line #2147(42), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 13: At line #2148(39), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 14: At line #2149(41), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 15: At line #2150(34), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > >
> > > // ############# Code Snippet ###############
> > > /*
> > > * EclipseXSDDemo2.java
> > > *
> > > * Created on May 2, 2003, 11:13 PM
> > > *
> > > */
> > >
> > > package org.paechoi.xsd.test;
> > >
> > > // W3C/DOM
> > > import javax.xml.parsers.DocumentBuilderFactory;
> > > import javax.xml.parsers.DocumentBuilder;
> > > import org.w3c.dom.Document;
> > > import org.w3c.dom.Element;
> > > // Eclipse/XSD
> > > import org.eclipse.xsd.util.XSDParser;
> > > import org.eclipse.xsd.XSDFactory;
> > > import org.eclipse.xsd.XSDSchema;
> > > import org.eclipse.xsd.impl.XSDSchemaImpl;
> > > import org.eclipse.xsd.util.XSDResourceImpl;
> > > import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> > > import org.eclipse.xsd.XSDDiagnostic;
> > > import org.eclipse.emf.ecore.resource.Resource;
> > > import org.eclipse.emf.ecore.resource.ResourceSet;
> > > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > > import org.eclipse.emf.common.util.EList;
> > > import java.io.File;
> > > import java.io.FileOutputStream;
> > > import java.io.PrintStream;
> > > import java.io.FileNotFoundException;
> > >
> > >
> > > /**
> > > *
> > > * @author pae
> > > */
> > > public class EclipseXSDDemo2 {
> > > // private Document xmlDOM = null;
> > > private XSDParser xsdParser = null;
> > >
> > > // instance initializer
> > > {
> > > //
> > >
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> > new
> > > XSDResourceFactoryImpl());
> > > }
> > >
> > > /** Creates a new instance of EclipseXSDDemo2 */
> > > public EclipseXSDDemo2() {
> > > super();
> > >
> > > // Redirect the System.err
> > > try {
> > > System.setErr(new PrintStream(new
> > > FileOutputStream("errors.log", true)));
> > > }
> > > catch (FileNotFoundException fileNotFoundException) {
> > > }
> > > }
> > >
> > > /** Open a XML DOM */
> > > private Document openXMLDOM(String uri) {
> > > // Create a factory object for creating DOM parsers
> > > DocumentBuilderFactory factory =
> > > DocumentBuilderFactory.newInstance();
> > > DocumentBuilder builder = null;
> > > Document xmlDoc = null;
> > >
> > > // Build a new DOM
> > > try {
> > > // Now use the factory to create a DOM parser (a.k.a. a
> > > DocumentBuilder)
> > > factory.setNamespaceAware(true);
> > > builder = factory.newDocumentBuilder();
> > > xmlDoc = builder.parse(uri);
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > return null;
> > > }
> > >
> > > return xmlDoc;
> > > }
> > >
> > > /** Open a XML DOM using XSDParser */
> > > private Document openXMLDOMUsingXSDParser(String uri) {
> > > Document xmlDoc = null;
> > >
> > > // Build a new DOM
> > > try {
> > > xsdParser = new XSDParser();
> > > xsdParser.parse(uri);
> > > xmlDoc = xsdParser.getDocument();
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > return null;
> > > }
> > >
> > > return xmlDoc;
> > > }
> > >
> > > /** doIt */
> > > private void doIt() {
> > > try {
> > > // Document xmlDOM =
> > > openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> > > // Document xmlDOM =
openXMLDOMUsingXSDParser("./wsdl.xsd");
> > > Document xmlDOM =
> > > openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
> > >
> > > Element rootElement = xmlDOM.getDocumentElement();
> > >
> > > XSDSchema xsdSchema =
XSDFactory.eINSTANCE.createXSDSchema();
> > > xsdSchema.setDocument(xmlDOM);
> > > xsdSchema.setElement(rootElement);
> > > xsdSchema.updateElement();
> > >
> > > System.out.println("\n\n");
> > > XSDResourceImpl.serialize(System.out,
xsdSchema.getElement());
> > >
> > > System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> > > >>>>>>>>>>>>>>>>>>>>>>>>>>");
> > > xsdSchema.validate();
> > > //EList eList = xsdMainSchema.getDiagnostics();
> > > EList eList = xsdSchema.getAllDiagnostics();
> > > for (int i = 0; i < eList.size(); i++) {
> > > XSDDiagnostic xsdDiagnostic =
(XSDDiagnostic)eList.get(i);
> > > System.out.println(i + ": At line #" +
> > > xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> > > xsdDiagnostic.getMessage() + "; Node = [" +
> > > xsdDiagnostic.getNode().getNodeName() + "]");
> > > }
> > >
> > >
> >
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> > > <<<<");
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > }
> > > }
> > >
> > > /** main - the main entry */
> > > public static void main(String[] args) {
> > > EclipseXSDDemo2 app = new EclipseXSDDemo2();
> > > app.doIt();
> > > }
> > > }
> > >
> > >
> > >
>
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #570501 is a reply to message #21189] Mon, 05 May 2003 12:12 Go to previous message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
v2.0.2,
and the diagnostic message came out as follows:


// ############## Diagnostic Messages #################
0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
not been resolved; Node = [xs:import]
1: At line #182(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
2: At line #183(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
3: At line #232(44), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
4: At line #833(59), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
5: At line #834(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
7: At line #841(47), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
8: At line #842(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
of 0, 1 as constrained by
'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
10: At line #1248(51), XSD: Attribute reference
'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
[xs:attribute]
11: At line #2146(37), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
12: At line #2147(42), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
13: At line #2148(39), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
14: At line #2149(41), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
15: At line #2150(34), XSD: The enumeration facet is not permitted in a type
based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]

Any comments?


Pae



"Pae Choi" <paechoi@earthlink.net> wrote in message
news:b95eu0$376$1@rogue.oti.com...
> I have tested [1]the metaschema with my sample code(XSD v1.0.2
> + EMF v1.0.2). And it gets 15 diagnostics messages.
>
> Any comments?
>
>
> Pae
>
> P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> v1.0.2 for now. :-(
>
> [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
>
>
> // ############## Diagnostic Messages #########
> 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> not been resolved; Node = [xs:import]
> 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 3: At line #232(44), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> 10: At line #1248(51), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
>
> // ############# Code Snippet ###############
> /*
> * EclipseXSDDemo2.java
> *
> * Created on May 2, 2003, 11:13 PM
> *
> */
>
> package org.paechoi.xsd.test;
>
> // W3C/DOM
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.parsers.DocumentBuilder;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> // Eclipse/XSD
> import org.eclipse.xsd.util.XSDParser;
> import org.eclipse.xsd.XSDFactory;
> import org.eclipse.xsd.XSDSchema;
> import org.eclipse.xsd.impl.XSDSchemaImpl;
> import org.eclipse.xsd.util.XSDResourceImpl;
> import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> import org.eclipse.xsd.XSDDiagnostic;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.common.util.EList;
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.PrintStream;
> import java.io.FileNotFoundException;
>
>
> /**
> *
> * @author pae
> */
> public class EclipseXSDDemo2 {
> // private Document xmlDOM = null;
> private XSDParser xsdParser = null;
>
> // instance initializer
> {
> //
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
new
> XSDResourceFactoryImpl());
> }
>
> /** Creates a new instance of EclipseXSDDemo2 */
> public EclipseXSDDemo2() {
> super();
>
> // Redirect the System.err
> try {
> System.setErr(new PrintStream(new
> FileOutputStream("errors.log", true)));
> }
> catch (FileNotFoundException fileNotFoundException) {
> }
> }
>
> /** Open a XML DOM */
> private Document openXMLDOM(String uri) {
> // Create a factory object for creating DOM parsers
> DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance();
> DocumentBuilder builder = null;
> Document xmlDoc = null;
>
> // Build a new DOM
> try {
> // Now use the factory to create a DOM parser (a.k.a. a
> DocumentBuilder)
> factory.setNamespaceAware(true);
> builder = factory.newDocumentBuilder();
> xmlDoc = builder.parse(uri);
> }
> catch (Exception ex) {
> ex.printStackTrace();
> return null;
> }
>
> return xmlDoc;
> }
>
> /** Open a XML DOM using XSDParser */
> private Document openXMLDOMUsingXSDParser(String uri) {
> Document xmlDoc = null;
>
> // Build a new DOM
> try {
> xsdParser = new XSDParser();
> xsdParser.parse(uri);
> xmlDoc = xsdParser.getDocument();
> }
> catch (Exception ex) {
> ex.printStackTrace();
> return null;
> }
>
> return xmlDoc;
> }
>
> /** doIt */
> private void doIt() {
> try {
> // Document xmlDOM =
> openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> // Document xmlDOM = openXMLDOMUsingXSDParser("./wsdl.xsd");
> Document xmlDOM =
> openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
>
> Element rootElement = xmlDOM.getDocumentElement();
>
> XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> xsdSchema.setDocument(xmlDOM);
> xsdSchema.setElement(rootElement);
> xsdSchema.updateElement();
>
> System.out.println("\n\n");
> XSDResourceImpl.serialize(System.out, xsdSchema.getElement());
>
> System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> >>>>>>>>>>>>>>>>>>>>>>>>>>");
> xsdSchema.validate();
> //EList eList = xsdMainSchema.getDiagnostics();
> EList eList = xsdSchema.getAllDiagnostics();
> for (int i = 0; i < eList.size(); i++) {
> XSDDiagnostic xsdDiagnostic = (XSDDiagnostic)eList.get(i);
> System.out.println(i + ": At line #" +
> xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> xsdDiagnostic.getMessage() + "; Node = [" +
> xsdDiagnostic.getNode().getNodeName() + "]");
> }
>
>
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> <<<<");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> /** main - the main entry */
> public static void main(String[] args) {
> EclipseXSDDemo2 app = new EclipseXSDDemo2();
> app.doIt();
> }
> }
>
>
>
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #570553 is a reply to message #21303] Mon, 05 May 2003 15:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Pae,

This version of XMLSchema.xsd is different from the cached version in
plugins/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd, which doesn't have
these problems. I'm upgrading the cached version to this newer version, which
contains errata changes.

This newer version revealed a bug I hadn't noticed before and fixing it
eliminates the diagnostics below except for 1, 3, 10. These three remaining
diagnostics are caused by failure to resolve the XMLSchema.dtd in the DOCTYPE
tag in the xml.xsd, so I fixed the XSDParser to resolve the XMLSchema.dtd. With
these changes, the file validates without any diagnostics.

It may be a week or two before we drop a version 1.1.0 build with these fixes...



Pae Choi wrote:

> I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
> v2.0.2,
> and the diagnostic message came out as follows:
>
> // ############## Diagnostic Messages #################
> 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> not been resolved; Node = [xs:import]
> 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 3: At line #232(44), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
> 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node = [xs:enumeration]
> 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
> 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node = [xs:enumeration]
> 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> of 0, 1 as constrained by
> 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> 10: At line #1248(51), XSD: Attribute reference
> 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> [xs:attribute]
> 11: At line #2146(37), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 12: At line #2147(42), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 13: At line #2148(39), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 14: At line #2149(41), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
> 15: At line #2150(34), XSD: The enumeration facet is not permitted in a type
> based on 'http://www.w3.org/2001/XMLSchema#string'; Node = [xs:enumeration]
>
> Any comments?
>
> Pae
>
> "Pae Choi" <paechoi@earthlink.net> wrote in message
> news:b95eu0$376$1@rogue.oti.com...
> > I have tested [1]the metaschema with my sample code(XSD v1.0.2
> > + EMF v1.0.2). And it gets 15 diagnostics messages.
> >
> > Any comments?
> >
> >
> > Pae
> >
> > P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> > v1.0.2 for now. :-(
> >
> > [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
> >
> >
> > // ############## Diagnostic Messages #########
> > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd' has
> > not been resolved; Node = [xs:import]
> > 1: At line #182(47), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 2: At line #183(39), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 3: At line #232(44), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 4: At line #833(59), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> [xs:enumeration]
> > 5: At line #834(42), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> [xs:enumeration]
> > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > 7: At line #841(47), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> [xs:enumeration]
> > 8: At line #842(42), XSD: The enumeration facet is not permitted in a type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> [xs:enumeration]
> > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > 10: At line #1248(51), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> > 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
> type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> [xs:enumeration]
> >
> > // ############# Code Snippet ###############
> > /*
> > * EclipseXSDDemo2.java
> > *
> > * Created on May 2, 2003, 11:13 PM
> > *
> > */
> >
> > package org.paechoi.xsd.test;
> >
> > // W3C/DOM
> > import javax.xml.parsers.DocumentBuilderFactory;
> > import javax.xml.parsers.DocumentBuilder;
> > import org.w3c.dom.Document;
> > import org.w3c.dom.Element;
> > // Eclipse/XSD
> > import org.eclipse.xsd.util.XSDParser;
> > import org.eclipse.xsd.XSDFactory;
> > import org.eclipse.xsd.XSDSchema;
> > import org.eclipse.xsd.impl.XSDSchemaImpl;
> > import org.eclipse.xsd.util.XSDResourceImpl;
> > import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> > import org.eclipse.xsd.XSDDiagnostic;
> > import org.eclipse.emf.ecore.resource.Resource;
> > import org.eclipse.emf.ecore.resource.ResourceSet;
> > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > import org.eclipse.emf.common.util.EList;
> > import java.io.File;
> > import java.io.FileOutputStream;
> > import java.io.PrintStream;
> > import java.io.FileNotFoundException;
> >
> >
> > /**
> > *
> > * @author pae
> > */
> > public class EclipseXSDDemo2 {
> > // private Document xmlDOM = null;
> > private XSDParser xsdParser = null;
> >
> > // instance initializer
> > {
> > //
> > Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new
> > XSDResourceFactoryImpl());
> > }
> >
> > /** Creates a new instance of EclipseXSDDemo2 */
> > public EclipseXSDDemo2() {
> > super();
> >
> > // Redirect the System.err
> > try {
> > System.setErr(new PrintStream(new
> > FileOutputStream("errors.log", true)));
> > }
> > catch (FileNotFoundException fileNotFoundException) {
> > }
> > }
> >
> > /** Open a XML DOM */
> > private Document openXMLDOM(String uri) {
> > // Create a factory object for creating DOM parsers
> > DocumentBuilderFactory factory =
> > DocumentBuilderFactory.newInstance();
> > DocumentBuilder builder = null;
> > Document xmlDoc = null;
> >
> > // Build a new DOM
> > try {
> > // Now use the factory to create a DOM parser (a.k.a. a
> > DocumentBuilder)
> > factory.setNamespaceAware(true);
> > builder = factory.newDocumentBuilder();
> > xmlDoc = builder.parse(uri);
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > return null;
> > }
> >
> > return xmlDoc;
> > }
> >
> > /** Open a XML DOM using XSDParser */
> > private Document openXMLDOMUsingXSDParser(String uri) {
> > Document xmlDoc = null;
> >
> > // Build a new DOM
> > try {
> > xsdParser = new XSDParser();
> > xsdParser.parse(uri);
> > xmlDoc = xsdParser.getDocument();
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > return null;
> > }
> >
> > return xmlDoc;
> > }
> >
> > /** doIt */
> > private void doIt() {
> > try {
> > // Document xmlDOM =
> > openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> > // Document xmlDOM = openXMLDOMUsingXSDParser("./wsdl.xsd");
> > Document xmlDOM =
> > openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
> >
> > Element rootElement = xmlDOM.getDocumentElement();
> >
> > XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema();
> > xsdSchema.setDocument(xmlDOM);
> > xsdSchema.setElement(rootElement);
> > xsdSchema.updateElement();
> >
> > System.out.println("\n\n");
> > XSDResourceImpl.serialize(System.out, xsdSchema.getElement());
> >
> > System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> > >>>>>>>>>>>>>>>>>>>>>>>>>>");
> > xsdSchema.validate();
> > //EList eList = xsdMainSchema.getDiagnostics();
> > EList eList = xsdSchema.getAllDiagnostics();
> > for (int i = 0; i < eList.size(); i++) {
> > XSDDiagnostic xsdDiagnostic = (XSDDiagnostic)eList.get(i);
> > System.out.println(i + ": At line #" +
> > xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> > xsdDiagnostic.getMessage() + "; Node = [" +
> > xsdDiagnostic.getNode().getNodeName() + "]");
> > }
> >
> >
> System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> > <<<<");
> > }
> > catch (Exception ex) {
> > ex.printStackTrace();
> > }
> > }
> >
> > /** main - the main entry */
> > public static void main(String[] args) {
> > EclipseXSDDemo2 app = new EclipseXSDDemo2();
> > app.doIt();
> > }
> > }
> >
> >
> >


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: A Test with http://www.w3.org/2001/XMLSchema.xsd [message #570659 is a reply to message #21312] Mon, 05 May 2003 21:17 Go to previous message
Eclipse UserFriend
Originally posted by: paechoi.earthlink.net

Ed,

Thank you for letting me know in detail. I'll look forward to seeing
your next quality work.

Best regards,


Pae

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3EB68637.F18DADB9@ca.ibm.com...
> Pae,
>
> This version of XMLSchema.xsd is different from the cached version in
> plugins/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd, which doesn't
have
> these problems. I'm upgrading the cached version to this newer version,
which
> contains errata changes.
>
> This newer version revealed a bug I hadn't noticed before and fixing it
> eliminates the diagnostics below except for 1, 3, 10. These three
remaining
> diagnostics are caused by failure to resolve the XMLSchema.dtd in the
DOCTYPE
> tag in the xml.xsd, so I fixed the XSDParser to resolve the XMLSchema.dtd.
With
> these changes, the file validates without any diagnostics.
>
> It may be a week or two before we drop a version 1.1.0 build with these
fixes...
>
>
>
> Pae Choi wrote:
>
> > I have rerunned the test Eclipse/XSD v1.1.0 + EMF v1.1.0 with Xerces-J
> > v2.0.2,
> > and the diagnostic message came out as follows:
> >
> > // ############## Diagnostic Messages #################
> > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd'
has
> > not been resolved; Node = [xs:import]
> > 1: At line #182(47), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 2: At line #183(39), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 3: At line #232(44), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 4: At line #833(59), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> > 5: At line #834(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
[xs:enumeration]
> > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be
one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > 7: At line #841(47), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> > 8: At line #842(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
[xs:enumeration]
> > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be
one
> > of 0, 1 as constrained by
> > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > 10: At line #1248(51), XSD: Attribute reference
> > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > [xs:attribute]
> > 11: At line #2146(37), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 12: At line #2147(42), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 13: At line #2148(39), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 14: At line #2149(41), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> > 15: At line #2150(34), XSD: The enumeration facet is not permitted in a
type
> > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
[xs:enumeration]
> >
> > Any comments?
> >
> > Pae
> >
> > "Pae Choi" <paechoi@earthlink.net> wrote in message
> > news:b95eu0$376$1@rogue.oti.com...
> > > I have tested [1]the metaschema with my sample code(XSD v1.0.2
> > > + EMF v1.0.2). And it gets 15 diagnostics messages.
> > >
> > > Any comments?
> > >
> > >
> > > Pae
> > >
> > > P.S.: XSD v1.1.0 is not working for me at present. So I am stuck with
> > > v1.0.2 for now. :-(
> > >
> > > [1] meataschema: http://www.w3.org/2001/XMLSchema.xsd
> > >
> > >
> > > // ############## Diagnostic Messages #########
> > > 0: At line #94(18), XSD: The location 'http://www.w3.org/2001/xml.xsd'
has
> > > not been resolved; Node = [xs:import]
> > > 1: At line #182(47), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 2: At line #183(39), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 3: At line #232(44), XSD: Attribute reference
> > > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > > [xs:attribute]
> > > 4: At line #833(59), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> > [xs:enumeration]
> > > 5: At line #834(42), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#decimal'; Node =
> > [xs:enumeration]
> > > 6: At line #830(26), XSD: The value '1' of attribute 'default' must be
one
> > > of 0, 1 as constrained by
> > > 'http://www.w3.org/2001/XMLSchema#minOccurs_._type'; Node = [default]
> > > 7: At line #841(47), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> > [xs:enumeration]
> > > 8: At line #842(42), XSD: The enumeration facet is not permitted in a
type
> > > based on 'http://www.w3.org/2001/XMLSchema#allNNI'; Node =
> > [xs:enumeration]
> > > 9: At line #838(27), XSD: The value '1' of attribute 'default' must be
one
> > > of 0, 1 as constrained by
> > > 'http://www.w3.org/2001/XMLSchema#maxOccurs_._type'; Node = [default]
> > > 10: At line #1248(51), XSD: Attribute reference
> > > 'http://www.w3.org/XML/1998/namespace#lang' is unresolved; Node =
> > > [xs:attribute]
> > > 11: At line #2146(37), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 12: At line #2147(42), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 13: At line #2148(39), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 14: At line #2149(41), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > > 15: At line #2150(34), XSD: The enumeration facet is not permitted in
a
> > type
> > > based on 'http://www.w3.org/2001/XMLSchema#string'; Node =
> > [xs:enumeration]
> > >
> > > // ############# Code Snippet ###############
> > > /*
> > > * EclipseXSDDemo2.java
> > > *
> > > * Created on May 2, 2003, 11:13 PM
> > > *
> > > */
> > >
> > > package org.paechoi.xsd.test;
> > >
> > > // W3C/DOM
> > > import javax.xml.parsers.DocumentBuilderFactory;
> > > import javax.xml.parsers.DocumentBuilder;
> > > import org.w3c.dom.Document;
> > > import org.w3c.dom.Element;
> > > // Eclipse/XSD
> > > import org.eclipse.xsd.util.XSDParser;
> > > import org.eclipse.xsd.XSDFactory;
> > > import org.eclipse.xsd.XSDSchema;
> > > import org.eclipse.xsd.impl.XSDSchemaImpl;
> > > import org.eclipse.xsd.util.XSDResourceImpl;
> > > import org.eclipse.xsd.util.XSDResourceFactoryImpl;
> > > import org.eclipse.xsd.XSDDiagnostic;
> > > import org.eclipse.emf.ecore.resource.Resource;
> > > import org.eclipse.emf.ecore.resource.ResourceSet;
> > > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> > > import org.eclipse.emf.common.util.EList;
> > > import java.io.File;
> > > import java.io.FileOutputStream;
> > > import java.io.PrintStream;
> > > import java.io.FileNotFoundException;
> > >
> > >
> > > /**
> > > *
> > > * @author pae
> > > */
> > > public class EclipseXSDDemo2 {
> > > // private Document xmlDOM = null;
> > > private XSDParser xsdParser = null;
> > >
> > > // instance initializer
> > > {
> > > //
> > >
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> > new
> > > XSDResourceFactoryImpl());
> > > }
> > >
> > > /** Creates a new instance of EclipseXSDDemo2 */
> > > public EclipseXSDDemo2() {
> > > super();
> > >
> > > // Redirect the System.err
> > > try {
> > > System.setErr(new PrintStream(new
> > > FileOutputStream("errors.log", true)));
> > > }
> > > catch (FileNotFoundException fileNotFoundException) {
> > > }
> > > }
> > >
> > > /** Open a XML DOM */
> > > private Document openXMLDOM(String uri) {
> > > // Create a factory object for creating DOM parsers
> > > DocumentBuilderFactory factory =
> > > DocumentBuilderFactory.newInstance();
> > > DocumentBuilder builder = null;
> > > Document xmlDoc = null;
> > >
> > > // Build a new DOM
> > > try {
> > > // Now use the factory to create a DOM parser (a.k.a. a
> > > DocumentBuilder)
> > > factory.setNamespaceAware(true);
> > > builder = factory.newDocumentBuilder();
> > > xmlDoc = builder.parse(uri);
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > return null;
> > > }
> > >
> > > return xmlDoc;
> > > }
> > >
> > > /** Open a XML DOM using XSDParser */
> > > private Document openXMLDOMUsingXSDParser(String uri) {
> > > Document xmlDoc = null;
> > >
> > > // Build a new DOM
> > > try {
> > > xsdParser = new XSDParser();
> > > xsdParser.parse(uri);
> > > xmlDoc = xsdParser.getDocument();
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > return null;
> > > }
> > >
> > > return xmlDoc;
> > > }
> > >
> > > /** doIt */
> > > private void doIt() {
> > > try {
> > > // Document xmlDOM =
> > > openXMLDOMUsingXSDParser("http://schemas.xmlsoap.org/wsdl/");
> > > // Document xmlDOM =
openXMLDOMUsingXSDParser("./wsdl.xsd");
> > > Document xmlDOM =
> > > openXMLDOMUsingXSDParser("http://www.w3.org/2001/XMLSchema.xsd");
> > >
> > > Element rootElement = xmlDOM.getDocumentElement();
> > >
> > > XSDSchema xsdSchema =
XSDFactory.eINSTANCE.createXSDSchema();
> > > xsdSchema.setDocument(xmlDOM);
> > > xsdSchema.setElement(rootElement);
> > > xsdSchema.updateElement();
> > >
> > > System.out.println("\n\n");
> > > XSDResourceImpl.serialize(System.out,
xsdSchema.getElement());
> > >
> > > System.out.println(">>>>>>>>>>>>>>>>>>>>>> VALIDATION
> > > >>>>>>>>>>>>>>>>>>>>>>>>>>");
> > > xsdSchema.validate();
> > > //EList eList = xsdMainSchema.getDiagnostics();
> > > EList eList = xsdSchema.getAllDiagnostics();
> > > for (int i = 0; i < eList.size(); i++) {
> > > XSDDiagnostic xsdDiagnostic =
(XSDDiagnostic)eList.get(i);
> > > System.out.println(i + ": At line #" +
> > > xsdDiagnostic.getLine() + "(" + xsdDiagnostic.getColumn() + "), " +
> > > xsdDiagnostic.getMessage() + "; Node = [" +
> > > xsdDiagnostic.getNode().getNodeName() + "]");
> > > }
> > >
> > >
> >
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<
> > > <<<<");
> > > }
> > > catch (Exception ex) {
> > > ex.printStackTrace();
> > > }
> > > }
> > >
> > > /** main - the main entry */
> > > public static void main(String[] args) {
> > > EclipseXSDDemo2 app = new EclipseXSDDemo2();
> > > app.doIt();
> > > }
> > > }
> > >
> > >
> > >
>
Previous Topic:Cannot run XSDFindTypesMissingFacets in V1.1.0
Next Topic:Old Xerces Version
Goto Forum:
  


Current Time: Tue Apr 23 14:50:51 GMT 2024

Powered by FUDForum. Page generated in 0.04533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top