You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Vijay S. Bajwa" <vi...@citigroup.com> on 2006/12/08 22:52:04 UTC

Why doesn't DOMPrint parse this:

Trying to get DOMPrint to do schema validation with the following. Why doesn't 
it look at the schema? Why does it not know that xsi is a namespace defined by 
by the xmlns attribute? When I turn on the namespace option (-n) it just hangs 
there! Thanks for help! - Vijay

$ DOMPrint -v=always  -s -f gtsEquityBlock.xml
Error at 
file "/home/vb11258/work/zas_apps/cmd/EASL/DOMPrint/gtsEquityBlock.xml", line 
3, column 16
   Message: Unknown element 'gtsEquityBlock'
Error at 
file "/home/vb11258/work/zas_apps/cmd/EASL/DOMPrint/gtsEquityBlock.xml", line 
3, column 27
   Message: Attribute 'xmlns:xsi' is not declared for element 'gtsEquityBlock'
Error at 
file "/home/vb11258/work/zas_apps/cmd/EASL/DOMPrint/gtsEquityBlock.xml", line 
3, column 101
   Message: Attribute 'xsi:noNamespaceSchemaLocation' is not declared for 
element 'gtsEquityBlock'
Error at 
file "/home/vb11258/work/zas_apps/cmd/EASL/DOMPrint/gtsEquityBlock.xml", line 
4, column 9
   Message: Unknown element 'msgHdr'
.....
.....

================ gtsEquityBlock.xml ================ 
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2007 (http://www.altova.com)-->
<gtsEquityBlock xsi:noNamespaceSchemaLocation="GTS-Oasys.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<msgHdr>
		<dateTime>2147483647</dateTime>
		<institution>aaaaaaaa</institution>
		<broker>aaaaaaaa</broker>
		<reference>100001</reference>
		<version>4096</version>
		<brkrIntRef>aaaaaaaaaaaaaaaa</brkrIntRef>
		<instIntRef>aaaaaaaaaaaaaaaa</instIntRef>
	</msgHdr>...
...
</gtsEquityBlock>


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Why doesn't DOMPrint parse this:

Posted by "Vijay S. Bajwa" <vi...@citigroup.com>.
David Bertoni <dbertoni <at> apache.org> writes:

> 
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!-- edited with XMLSpy v2007 (http://www.altova.com) by Vijay S. Bajwa 
> > (Citigroup) -->
> > <xs:schema xmlns:oas="http://citigroup.com/gts/oasys" 
> > xmlns:xs="http://www.w3.org/2001/XMLSche
> > ma" elementFormDefault="unqualified" attributeFormDefault="unqualified">
> >     <xs:element name="gtsEquityBlock">
> >         <xs:annotation>
> >             <xs:documentation>Bundled eqty block plus all allocs (upto 
10,000)
> > </xs:documentati
> > on>
> >         </xs:annotation>
> >         <xs:complexType>
> >             <xs:sequence>
> >                 <xs:element name="msgHdr" type="MsgHdrType"/>
> >                 <xs:element name="eqtyBlock" type="EquityBlockType"/>
> >                 <xs:element name="eqtyAlloc" type="EquityAllocType" 
> > maxOccurs="10000"/>
> >             </xs:sequence>
> >         </xs:complexType>
> >     </xs:element>
> >     <xs:complexType name="MsgHdrType">
> > ...
> > </xs:schema>

The problem was the maxOccurs="10000". Even the SAXPrint had a problem with 
this, just hung there for a long time, but SAXPrint eventually came back and 
walked thru the XML. So, I changed maxOccurs="10000" to maxOccurs="unbounded"  
and voila! everything started working.

Thanks for all your help David. I learned a lot from it.

Regards,
Vijay


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Why doesn't DOMPrint parse this:

Posted by David Bertoni <db...@apache.org>.
Vijay S. Bajwa wrote:
> David Bertoni <dbertoni <at> apache.org> writes:
> 
>> Vijay S. Bajwa wrote:
>>> Trying to get DOMPrint to do schema validation with the following. Why 
> doesn't 
>>> it look at the schema? Why does it not know that xsi is a namespace defined 
> by 
>>> by the xmlns attribute? When I turn on the namespace option (-n) it just 
> hangs 
>>> there! Thanks for help! - Vijay
>> Without enabling namespace processing, you will get DTD validation, so you 
>> get validation errors.
>>
>> If, when you enable namespace processing, the parser just "hangs there," 
>> perhaps there's something in your schema document that's the culprit.  For 
>> example, there may be URLs in your schema document that the parser is 
>> trying to dereference.
>>
>> Dave
>>
> 
> The schema doc is below. It is clearly trying to reach these URI's because if I 
> take these out, then it complains "xs" is not associated with any URI. What is 
> the problem with the schema? Really appreciate help as I'm new to this whole 
> thing. (not trying to get out on the cheap, have pored over lots of specs...):

Namespace declarations like:

xmlns:xs="http://www.w3.org/2001/XMLSchema"

are _never_ dereferenced by the parser.

> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XMLSpy v2007 (http://www.altova.com) by Vijay S. Bajwa 
> (Citigroup) -->
> <xs:schema xmlns:oas="http://citigroup.com/gts/oasys" 
> xmlns:xs="http://www.w3.org/2001/XMLSche
> ma" elementFormDefault="unqualified" attributeFormDefault="unqualified">
>     <xs:element name="gtsEquityBlock">
>         <xs:annotation>
>             <xs:documentation>Bundled eqty block plus all allocs (upto 10,000)
> </xs:documentati
> on>
>         </xs:annotation>
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="msgHdr" type="MsgHdrType"/>
>                 <xs:element name="eqtyBlock" type="EquityBlockType"/>
>                 <xs:element name="eqtyAlloc" type="EquityAllocType" 
> maxOccurs="10000"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
>     <xs:complexType name="MsgHdrType">
> ...
> </xs:schema>

Since you've snipped out the rest of the schema document, it's hard to say 
what might be going on.  For the most part, only xs:include and xs:import 
elements result in the parser dereferencing URLs.

You can find out what's going on by implementing the EntityResolver 
abstract base class, and installing an instance of your implementation into 
the parser.  You could then set breakpoints in the resolveEntity() 
function, or write the values of the parameters to stderr, or something 
like that.

If the parser is not stalled trying to load URLs, then there must be some 
other reason why it is unable to load your schema document.  In that case, 
you'll need to use the debugger to figure out what's going on.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Why doesn't DOMPrint parse this:

Posted by "Vijay S. Bajwa" <vi...@citigroup.com>.
David Bertoni <dbertoni <at> apache.org> writes:

> 
> Vijay S. Bajwa wrote:
> > Trying to get DOMPrint to do schema validation with the following. Why 
doesn't 
> > it look at the schema? Why does it not know that xsi is a namespace defined 
by 
> > by the xmlns attribute? When I turn on the namespace option (-n) it just 
hangs 
> > there! Thanks for help! - Vijay
> 
> Without enabling namespace processing, you will get DTD validation, so you 
> get validation errors.
> 
> If, when you enable namespace processing, the parser just "hangs there," 
> perhaps there's something in your schema document that's the culprit.  For 
> example, there may be URLs in your schema document that the parser is 
> trying to dereference.
> 
> Dave
> 

The schema doc is below. It is clearly trying to reach these URI's because if I 
take these out, then it complains "xs" is not associated with any URI. What is 
the problem with the schema? Really appreciate help as I'm new to this whole 
thing. (not trying to get out on the cheap, have pored over lots of specs...):

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 (http://www.altova.com) by Vijay S. Bajwa 
(Citigroup) -->
<xs:schema xmlns:oas="http://citigroup.com/gts/oasys" 
xmlns:xs="http://www.w3.org/2001/XMLSche
ma" elementFormDefault="unqualified" attributeFormDefault="unqualified">
    <xs:element name="gtsEquityBlock">
        <xs:annotation>
            <xs:documentation>Bundled eqty block plus all allocs (upto 10,000)
</xs:documentati
on>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="msgHdr" type="MsgHdrType"/>
                <xs:element name="eqtyBlock" type="EquityBlockType"/>
                <xs:element name="eqtyAlloc" type="EquityAllocType" 
maxOccurs="10000"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="MsgHdrType">
...
</xs:schema>

Thanks! Vijay



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Why doesn't DOMPrint parse this:

Posted by David Bertoni <db...@apache.org>.
Vijay S. Bajwa wrote:
> Trying to get DOMPrint to do schema validation with the following. Why doesn't 
> it look at the schema? Why does it not know that xsi is a namespace defined by 
> by the xmlns attribute? When I turn on the namespace option (-n) it just hangs 
> there! Thanks for help! - Vijay

Without enabling namespace processing, you will get DTD validation, so you 
get validation errors.

If, when you enable namespace processing, the parser just "hangs there," 
perhaps there's something in your schema document that's the culprit.  For 
example, there may be URLs in your schema document that the parser is 
trying to dereference.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org