OK... sorted. The problem is that your schema targetNamespace is
"http://www.roguewave.com/uri/catalog/
" but the document namspace uri is "http://www.roguewave.com/uri/catalog/"
Spot the difference? There is a space at the end of the schema
targetNamespace so they do not match! I guess the question is should
trailing (or leading) spaces be ignored?
Cheers,
On 16/05/07, Pete Robbins <[EMAIL PROTECTED]> wrote:
I'll take a look at this.
On 16/05/07, Andy Grove <[EMAIL PROTECTED]> wrote:
>
>
> I'm now trying to parse a document that does have a schema and I'm still
> running into the same problem - my document has no root object and no
> root element name.
>
> Any help figuring out why this isn't working would be very much
> appreciated. I'm running this on a Windows platform. Source code and XML
> / XSD below.
>
> Thanks,
>
> Andy.
>
> --------------------------------------
>
> C++ source code:
>
> DataFactoryPtr myDf = DataFactory::getDataFactory();
> XSDHelperPtr helper = HelperProvider::getXSDHelper(myDf);
> helper->defineFile( " catalog.xsd" );
> XMLDocumentPtr doc = xmlHelper->loadFile( "catalog.xml" );
>>> Whre/how is xmlHelper defined? I'd expect a line:
XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(myDf);
DataObjectPtr root = doc->getRootDataObject();
> if (!root) {
> fprintf(stderr, "NO ROOT\n"); fflush(stderr); // this *is*
> output to the console
> }
>
> XML document:
>
> <catalog xmlns="http://www.roguewave.com/uri/catalog/"
> xsi:schemaLocation=" http://www.roguewave.com/uri/catalog/ catalog.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <product>
> <id>0</id>
> <name>Product #0</name>
> <description>This is the description for product #0</description>
> </product>
> </catalog>
>
> XML schema:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.roguewave.com/uri/catalog/ "
> elementFormDefault="qualified">
>
> <xs:element name="catalog">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="product" maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="id" type="xs:string"/>
> <xs:element name="name" type="xs:string"/>
> <xs:element name="description" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> </xs:schema>
>
>
> -----Original Message-----
> From: Caroline Maynard [mailto:[EMAIL PROTECTED]
> Sent: 27 April 2007 16:41
> To: [email protected]
> Subject: Re: [C++] XMLDocument has no root object
>
> On 27/04/07, Andy Grove <[EMAIL PROTECTED]> wrote:
> >
> >
> > I'm not using schema - is that a problem?
>
>
>
> Ah. Welcome to https://issues.apache.org/jira/browse/TUSCANY-747
>
> --
> Caroline
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Pete
--
Pete