Xerces c++ getNodeType() Problem..

  • Thread starter christian.eickhoff
  • Start date
C

christian.eickhoff

Hello Everybody,

am currently developing some coder for XML files but am facing some
minor problem which might be very easy to solve for XERCES experts. For
my coder it is indispensable to determine the type of the current Node
out of the XSD Schema file but when I use the function:
Node->getNodeType(), I always receive the value 1 even if I am dealing
with an ATTRIBUTE_NODE like this:

Schema file subsection:
<xsd:attribute name="type" type="mimeTopLevelType" use="required" />
(should be enum value 2 as far as I know..)

For test purposes I do this very simple output on the Node from up
above for example:
short childtype = myChild->getNodeType();
std::cout << "Element Type: " << childtype <<'\n';

Return value:
Element Type: 1

What am I doing wrong? Am really confused as the type determiniation
seems to be an easy task and as I get the correct values for
Node->getNodeName and Node->hasChildNodes.. Any hint or help is highly
appreciated!!

Thanks in advance :)
Christian
 
J

Joe Kesselman

I'm not sure from your description, but it sounds like you're trying to
use the DOM calls to examine an XML document which happens to be a
schema. That will give you information about the schema as a document,
NOT information about the documents that schema describes. Xerces does
have a separate API for examining schemas, if that's what you're looking
for.

Either that, or you're querying a different node than you think you are.
You didn't provide enough detail to tell us exactly what file you're
loading or how you're obtaining the "mychild" node.
 
S

spiff

Hi Christian!

Just to say the obvious in the beginning: the node "xsd:attribute" is
of type Element.

If this is not the problem did you try to use DOMNamedNodeMap*
DOMNode::getAttributes ()?

regards
spiff


http://www.spycomponents.com
XML tools for XMLSpy
 
C

christian.eickhoff

So sorry everbody for bothering you with this stupid question..
Was just a personal misunderstanding in XML Schema Syntax as I thought
attributes have to be definied along with the element itself. I promise
that next time I wont post a question anymore after haven´t thought
about it hundred times..

Thanks to both of the previous writers for guiding me on the right
track..

Regards,
Christian
 
J

Joe Kesselman

So sorry everbody for bothering you with this stupid question..

That's OK. Sometimes the best way to figure out that you're asking the
wrong question is to try to explain the problem to someone else...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top