<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/
XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Site">
<xs:complexType>
<xs:sequence>
<xs:element name="Server" type="xs:string" />
<xs:element name="Username" type="xs:string" />
<xs:element name="Password" type="xs:string" />
<xs:element name="LocalDirectory" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
...had it working before (about 2 months ago) - but now I can't seem
to get it to work at all and am not sure what the problem is - perhaps
I'm just too tired.
here's the code (if you think it'll help):
public class XSDFormGen extends VerticalPanel{
public XSDFormGen(String xsd) {
try {
Document doc = XMLParser.parse(xsd);
_XSD_ComplexType(doc.getDocumentElement().getChildNodes());
}
catch (Exception Error){
Window.alert("Error: "+Error.getMessage());
}
}
private void _XSD_ComplexType(NodeList nodes) {
FlexTable t = new FlexTable();
t.setBorderWidth(1);
int row = 0;
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
String name = n.getNodeName();
String value = n.getNodeValue();
if ( name.equals("xs:element") ) {
Node atype = n.getAttributes().getNamedItem("type");
Node aname = n.getAttributes().getNamedItem("name");
if ( ( atype != null ) && (aname != null) ) {
String stype = atype.getNodeValue();
String sname = aname.getNodeValue();
if ( stype.equals("xs:string") ) {
t.setText(row, 0, sname);
TextBox TempTxt = new TextBox();
TempTxt.setText(value);
t.setWidget(row, 1, TempTxt);
row ++;
} else if ( stype.equals("xs:boolean") ) {
t.setText(row, 0, "");
t.setWidget(row, 1, new CheckBox(sname));
row ++;
} else {
}
}
}
_XSD_ComplexType(n.getChildNodes());
}
this.add(t);
}
}
> Anyone have any idea why the XMLParser.parse() method is failing to
> parse the following xml?
> took this header (<?xml version="1.0" encoding="utf-8"?>) and a few
> other elements etc out to simplify the file... but still no luck:
>
> <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
> elementFormDefault="qualified"
> xmlns="http://tempuri.org/ XMLSchema.xsd"
The declaration of the default namespace should be just a namespace
URI, not a namespace URI and a schema file reference.
However, you're not using the default namespace in your file so you
can remove the previous line.
> xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
This value must be a namespace URI, followed by a space, followed by
a schema file reference. Maybe you meant to have a space after the
last slash. However, you're not using the mstns prefix anywhere so
you can remove this line.