|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
xmlbeans errorHello,
I am trying to create document object RequestDocument doc2 = RequestDocument.Factory.parse("Input.xml"); from the following xml schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://xmlbeans.apache.org/myschema" xmlns:mc="http://xmlbeans.apache.org/myschema" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="request" type="mc:requestType"> </xs:element> <xs:complexType name="requestType"> <xs:sequence> <xs:element name="serviceName" type="xs:string"/> <xs:element name="serviceMethod" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> I see the following exception: ( here is Input.xml) <xml-fragment><any:serviceName xmlns:any="http://xmlbeans.apache.org/samples/any">test_serviceName</any:serviceName><any:serviceMethod xmlns:any="http://xmlbeans.apache.org/samples/any">test_serviceMethod</any:serviceMethod></xml-fragment> !!!! error: The document is not a request@http://xmlbeans.apache.org/samples/any: multiple document elements org.apache.xmlbeans.XmlException: error: The document is not a request@http://xmlbeans.apache.org/samples/any: multiple document elements at org.apache.xmlbeans.impl.store.Locale.verifyDocumentType(Locale.java:452) at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:357) at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:709) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:690) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:677) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208) at org.apache.xmlbeans.samples.any.RequestDocument$Factory.parse(Unknown Source) at Test.main(Test.java:30) Can someone point me what the nature of problem is with that schema? Thank you for the help, |
|
|
Re: xmlbeans errorRequestDocument is the reference to the element and your input.xml
should look like: <any: request xmlns:any="http://xmlbeans.apache.org/samples/any"> <any:serviceName >test_serviceName</any:serviceName> <any:serviceMethod>test_serviceMethod</any:serviceMethod> </any:request> I suspect you generated input.xml using RequestType. Please let us know if you are still having trouble, -Jacobd On 8/24/07, smx_ <vlyamtsev@...> wrote: > > Hello, > I am trying to create document object > RequestDocument doc2 = RequestDocument.Factory.parse("Input.xml"); > from the following xml schema: > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema targetNamespace="http://xmlbeans.apache.org/myschema" > xmlns:mc="http://xmlbeans.apache.org/myschema" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified"> > > <xs:element name="request" type="mc:requestType"> > </xs:element> > <xs:complexType name="requestType"> > <xs:sequence> > <xs:element name="serviceName" type="xs:string"/> > <xs:element name="serviceMethod" type="xs:string"/> > </xs:sequence> > </xs:complexType> > </xs:schema> > > I see the following exception: > ( here is Input.xml) > <xml-fragment><any:serviceName > xmlns:any="http://xmlbeans.apache.org/samples/any">test_serviceName</any:serviceName><any:serviceMethod > xmlns:any="http://xmlbeans.apache.org/samples/any">test_serviceMethod</any:serviceMethod></xml-fragment> > !!!! > error: The document is not a request@http://xmlbeans.apache.org/samples/any: > multiple document elements > org.apache.xmlbeans.XmlException: error: The document is not a > request@http://xmlbeans.apache.org/samples/any: multiple document elements > at > org.apache.xmlbeans.impl.store.Locale.verifyDocumentType(Locale.java:452) > at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:357) > at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:709) > at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:690) > at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:677) > at > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208) > at org.apache.xmlbeans.samples.any.RequestDocument$Factory.parse(Unknown > Source) > at Test.main(Test.java:30) > > Can someone point me what the nature of problem is with that schema? > Thank you for the help, > > -- > View this message in context: http://www.nabble.com/xmlbeans-error-tf4325861.html#a12320067 > Sent from the Xml Beans - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: xmlbeans errorI managed to get marshalling/unmarshalling working following one of the samples but I really don't understand it.. I just declared my element in the schema like following:
<xs:element name="myrequest"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="request" type="tns:requestType"/> </xs:choice> </xs:complexType> </xs:element> vs. just <xs:element name="request" type="tns:requestType"/> But I still have <xml-fragment> as root tag in the resulting xml. E.g. resulting xml looks as following: <xml-fragment> <any:serviceName >test_serviceName</any:serviceName> <any:serviceMethod>test_serviceMethod</any:serviceMethod> </xml-fragment> Any ideas? Thank you again. smx
|
| Free embeddable forum powered by Nabble | Forum Help |