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 Steve Harrington <sh...@aoc.nrao.edu> on 2004/12/14 17:57:26 UTC

DOMTypeInfo::getName - changes from xerces 2.5 to 2.6??

Hi,

I had some working code that I was running with xerces 2.5 and when I changed to 
xerces 2.6, it broke. Did something related to DOMTypeInfo change? Here's the 
code snippet:

for (unsigned int i = 0; i < paramNodes->getLength(); i++) {
	DOMNode * paramItem = paramNodes->item(i);
	if(paramItem->getNodeType() == DOMNode::ELEMENT_NODE) {
		DOMElement * paramElem = (DOMElement*)paramItem;
		const DOMTypeInfo * typeInfo = paramElem->getTypeInfo();
		const XMLCh* typeName = typeInfo->getName();
		// check the type of parameter and instantiate the proper class
		if(XMLString::equals(typeName, INT_PARAM_TYPE))
		{
			handleIntParam(paramElem);
		}
		// etc...
}

Under 2.5, this worked fine whereas now it seems that I'm getting nothing for 
the typeName (from DOMTypeInfo::getName method). I realize it says "experimental 
and subject to change" on the API documentation - perhaps I've played with fire 
and am now being burned :-) If there is a better way to get the name of the type 
then what I'm doing here, I'd be happy to change my code.

Cheers, Steve

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


Re: DOMTypeInfo::getName - changes from xerces 2.5 to 2.6??

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hey,

	I don't have any time today, but will get to this tomorrow.

Gareth

Steve Harrington wrote:
> Gareth,
> 
> I have attached a stripped down set of files having removed most of the 
> non-related code. This small set of files includes a main method which 
> will illustrate the problem. You can run it against the XML file 
> pset-testing.xml (which is an instance of the schema pset.xsd) - all 
> included in the tar file. It works fine with xerces 2.5 but fails under 
> 2.6. Any insight is appreciated.
> 
> After building it, to execute simply type:
> 
>     testDOM -file pset-testing.xml
> 
> Let me know if you need more information.
> 
> Thanks, Steve
> 
> 
> 
> Gareth Reakes wrote:
> 
>> Hi,
>>
>>     Could you provide us with a small snippet of xml and the code you 
>> use to parse the document?
>>
>> Cheers,
>>
>> Gareth
>>
>> Steve Harrington wrote:
>>
>>> Hi,
>>>
>>> I had some working code that I was running with xerces 2.5 and when I 
>>> changed to xerces 2.6, it broke. Did something related to DOMTypeInfo 
>>> change? Here's the code snippet:
>>>
>>> for (unsigned int i = 0; i < paramNodes->getLength(); i++) {
>>>     DOMNode * paramItem = paramNodes->item(i);
>>>     if(paramItem->getNodeType() == DOMNode::ELEMENT_NODE) {
>>>         DOMElement * paramElem = (DOMElement*)paramItem;
>>>         const DOMTypeInfo * typeInfo = paramElem->getTypeInfo();
>>>         const XMLCh* typeName = typeInfo->getName();
>>>         // check the type of parameter and instantiate the proper class
>>>         if(XMLString::equals(typeName, INT_PARAM_TYPE))
>>>         {
>>>             handleIntParam(paramElem);
>>>         }
>>>         // etc...
>>> }
>>>
>>> Under 2.5, this worked fine whereas now it seems that I'm getting 
>>> nothing for the typeName (from DOMTypeInfo::getName method). I 
>>> realize it says "experimental and subject to change" on the API 
>>> documentation - perhaps I've played with fire and am now being burned 
>>> :-) If there is a better way to get the name of the type then what 
>>> I'm doing here, I'd be happy to change my code.
>>>
>>> Cheers, Steve
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>>
>>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

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


Re: DOMTypeInfo::getName - changes from xerces 2.5 to 2.6??

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hey,

	Sorry for the length of time replying. It completely slipped my mind 
that you now have to turn PSVI info on to get the info.

setFeature(XMLUni::fgXercesDOMHasPSVIInfo, true)

Is what you need. The old code was not thread safe, so when we had full 
PSVI info we decided to move across to using that. It means we can lose 
that old code as well, which will increase performance quite a lot.

Regards,

Gareth


Steve Harrington wrote:
> Gareth,
> 
> I have attached a stripped down set of files having removed most of the 
> non-related code. This small set of files includes a main method which 
> will illustrate the problem. You can run it against the XML file 
> pset-testing.xml (which is an instance of the schema pset.xsd) - all 
> included in the tar file. It works fine with xerces 2.5 but fails under 
> 2.6. Any insight is appreciated.
> 
> After building it, to execute simply type:
> 
>     testDOM -file pset-testing.xml
> 
> Let me know if you need more information.
> 
> Thanks, Steve
> 
> 
> 
> Gareth Reakes wrote:
> 
>> Hi,
>>
>>     Could you provide us with a small snippet of xml and the code you 
>> use to parse the document?
>>
>> Cheers,
>>
>> Gareth
>>
>> Steve Harrington wrote:
>>
>>> Hi,
>>>
>>> I had some working code that I was running with xerces 2.5 and when I 
>>> changed to xerces 2.6, it broke. Did something related to DOMTypeInfo 
>>> change? Here's the code snippet:
>>>
>>> for (unsigned int i = 0; i < paramNodes->getLength(); i++) {
>>>     DOMNode * paramItem = paramNodes->item(i);
>>>     if(paramItem->getNodeType() == DOMNode::ELEMENT_NODE) {
>>>         DOMElement * paramElem = (DOMElement*)paramItem;
>>>         const DOMTypeInfo * typeInfo = paramElem->getTypeInfo();
>>>         const XMLCh* typeName = typeInfo->getName();
>>>         // check the type of parameter and instantiate the proper class
>>>         if(XMLString::equals(typeName, INT_PARAM_TYPE))
>>>         {
>>>             handleIntParam(paramElem);
>>>         }
>>>         // etc...
>>> }
>>>
>>> Under 2.5, this worked fine whereas now it seems that I'm getting 
>>> nothing for the typeName (from DOMTypeInfo::getName method). I 
>>> realize it says "experimental and subject to change" on the API 
>>> documentation - perhaps I've played with fire and am now being burned 
>>> :-) If there is a better way to get the name of the type then what 
>>> I'm doing here, I'd be happy to change my code.
>>>
>>> Cheers, Steve
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>>
>>>
>>
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

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


Re: DOMTypeInfo::getName - changes from xerces 2.5 to 2.6??

Posted by Steve Harrington <sh...@aoc.nrao.edu>.
Gareth,

I have attached a stripped down set of files having removed most of the 
non-related code. This small set of files includes a main method which will 
illustrate the problem. You can run it against the XML file pset-testing.xml 
(which is an instance of the schema pset.xsd) - all included in the tar file. It 
works fine with xerces 2.5 but fails under 2.6. Any insight is appreciated.

After building it, to execute simply type:

	testDOM -file pset-testing.xml

Let me know if you need more information.

Thanks, Steve



Gareth Reakes wrote:
> Hi,
> 
>     Could you provide us with a small snippet of xml and the code you 
> use to parse the document?
> 
> Cheers,
> 
> Gareth
> 
> Steve Harrington wrote:
> 
>> Hi,
>>
>> I had some working code that I was running with xerces 2.5 and when I 
>> changed to xerces 2.6, it broke. Did something related to DOMTypeInfo 
>> change? Here's the code snippet:
>>
>> for (unsigned int i = 0; i < paramNodes->getLength(); i++) {
>>     DOMNode * paramItem = paramNodes->item(i);
>>     if(paramItem->getNodeType() == DOMNode::ELEMENT_NODE) {
>>         DOMElement * paramElem = (DOMElement*)paramItem;
>>         const DOMTypeInfo * typeInfo = paramElem->getTypeInfo();
>>         const XMLCh* typeName = typeInfo->getName();
>>         // check the type of parameter and instantiate the proper class
>>         if(XMLString::equals(typeName, INT_PARAM_TYPE))
>>         {
>>             handleIntParam(paramElem);
>>         }
>>         // etc...
>> }
>>
>> Under 2.5, this worked fine whereas now it seems that I'm getting 
>> nothing for the typeName (from DOMTypeInfo::getName method). I realize 
>> it says "experimental and subject to change" on the API documentation 
>> - perhaps I've played with fire and am now being burned :-) If there 
>> is a better way to get the name of the type then what I'm doing here, 
>> I'd be happy to change my code.
>>
>> Cheers, Steve
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>
>>
> 


Re: DOMTypeInfo::getName - changes from xerces 2.5 to 2.6??

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hi,

	Could you provide us with a small snippet of xml and the code you use 
to parse the document?

Cheers,

Gareth

Steve Harrington wrote:
> Hi,
> 
> I had some working code that I was running with xerces 2.5 and when I 
> changed to xerces 2.6, it broke. Did something related to DOMTypeInfo 
> change? Here's the code snippet:
> 
> for (unsigned int i = 0; i < paramNodes->getLength(); i++) {
>     DOMNode * paramItem = paramNodes->item(i);
>     if(paramItem->getNodeType() == DOMNode::ELEMENT_NODE) {
>         DOMElement * paramElem = (DOMElement*)paramItem;
>         const DOMTypeInfo * typeInfo = paramElem->getTypeInfo();
>         const XMLCh* typeName = typeInfo->getName();
>         // check the type of parameter and instantiate the proper class
>         if(XMLString::equals(typeName, INT_PARAM_TYPE))
>         {
>             handleIntParam(paramElem);
>         }
>         // etc...
> }
> 
> Under 2.5, this worked fine whereas now it seems that I'm getting 
> nothing for the typeName (from DOMTypeInfo::getName method). I realize 
> it says "experimental and subject to change" on the API documentation - 
> perhaps I've played with fire and am now being burned :-) If there is a 
> better way to get the name of the type then what I'm doing here, I'd be 
> happy to change my code.
> 
> Cheers, Steve
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

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