Hi again,
as far as I understand it elementFormDefault="qualified" should
not affect the parsed xml document. setDoSchema to true is what seems to
be stripping out the prefix. Without it they remain. This problem also
occurs in the nightly build. I have a strong feeling that this has been
reported recently but a brief look at Bugzilla does not reveal anything.
Anyone else remember?
Gareth
On Tue, 14 May 2002, David R. wrote:
> Hello Radovan, I had never used the attribute elementFormDefault before. Do
> I have to specify this attribute only in the Schema definition, or somewhere
> else? I proceeded like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:my="http://david.com/david-schema"
> targetNamespace="http://david.com/david-schema"
> elementFormDefault="qualified">
>
> <xs:element name="addressbook">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="my:person" minOccurs='1' maxOccurs='unbounded'/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> <xs:element name="person" type="xs:string"/>
>
> </xs:schema>
>
> But the output I get is exactly the same than before (prefix is NULL). Do
> you have some other hints of something I can try? Thanks.
>
>
> >From: "Radovan Chytracek" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: <[EMAIL PROTECTED]>
> >Subject: RE: DOM_Node::getPrefix() always returns NULL
> >Date: Tue, 14 May 2002 15:43:43 +0200
> >
> >Hi,
> >
> > did you try to set the attribute as:
> >
> > elementFormDefault="qualified"
> >
> >???
> >
> >Radovan
> >
> > > -----Original Message-----
> > > From: David R. [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, 14 May 2002 15:41
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: DOM_Node::getPrefix() always returns NULL
> > >
> > >
> > > Sorry for the delay in my response Gareth. I had to extract a piece of
> >code
> > > from my application in order to make a more simple example.
> > >
> > > I have tried both Xerces 1.6 and 1.7 with identical results.
> > >
> > > The parsing is performed in the usual way by means of the
> > > DOMParser::parse()
> > > method, previously setting the following attributes:
> > > - setValidationScheme( DOMParser::Val_Always);
> > > - setDoNamespaces( true );
> > > - setDoSchema( true );
> > > - setValidationSchemaFullChecking( true );
> > >
> > > Once the DOM tree has been constructed in memory, the following lines
> >are
> > > executed:
> > > DOM_Node& node = document.getDocumentElement();
> > > cout << "Document element getNodeName(): " <<
> > > node.getNodeName().transcode()
> > > << endl;
> > > cout << "Document element getTagName(): " <<
> > > ((DOM_Element&)node).getTagName().transcode() << endl;
> > > cout << "Document element getNamespaceURI(): " <<
> > > node.getNamespaceURI().transcode() << endl;
> > > cout << "Document element getPrefix(): " << node.getPrefix().transcode()
> ><<
> > > endl;
> > > cout << "Document element getLocalName(): " <<
> > > node.getLocalName().transcode() << endl;
> > > DOM_Node& child = node.getChildNodes().item(1);
> > > cout << "Child element getNodeName(): " <<
> >child.getNodeName().transcode()
> > > << endl;
> > > cout << "Child element getTagName(): " <<
> > > ((DOM_Element&)child).getTagName().transcode() << endl;
> > > cout << "Child element getNamespaceURI(): " <<
> > > child.getNamespaceURI().transcode() << endl;
> > > cout << "Child element getPrefix(): " << child.getPrefix().transcode()
> ><<
> > > endl;
> > > cout << "Child element getLocalName(): " <<
> > > child.getLocalName().transcode()
> > > << endl;
> > >
> > > This is the output I get:
> > > Document element getNodeName(): addressbook
> > > Document element getTagName(): addressbook
> > > Document element getNamespaceURI(): http://david.com/david-schema
> > > Document element getPrefix():
> > > Document element getLocalName(): addressbook
> > > Child element getNodeName(): person
> > > Child element getTagName(): person
> > > Child element getNamespaceURI(): http://david.com/david-schema
> > > Child element getPrefix():
> > > Child element getLocalName(): person
> > >
> > > I wonder whether the method DOM_Node::getPrefix() is the only that is
> > > failing in the returned value or some other methods
> > > (DOM_Node::getNodeName(), DOM_Element::getTagName()) are ignoring
> > > the prefix
> > > as well.
> > >
> > > I am not an experienced developer in Xerces programming so it might be
> >due
> > > to my inexperience. Some advice would be appreciated.
> > >
> > > Best regards,
> > > David Ruana
> > >
> > >
> > > >From: Gareth Reakes <[EMAIL PROTECTED]>
> > > >Reply-To: [EMAIL PROTECTED]
> > > >To: <[EMAIL PROTECTED]>
> > > >Subject: Re: DOM_Node::getPrefix() always returns NULL
> > > >Date: Tue, 14 May 2002 09:29:19 +0100 (BST)
> > > >
> > > >Hi,
> > > > I seem to remember a bug being reported not so long ago where
> > > >prefix's were being stripped out when validated. What version of xerces
> >are
> > > >you using? Have you tried the nightly build? Please feel free to post
> >the
> > > >code snippet so we can take a look.
> > > >
> > > >Gareth
> > > >
> > > >
> > > >On Tue, 14 May 2002, David R. wrote:
> > > >
> > > > > In the following example, I am parsing the XML file and trying to
> >get
> > > >the
> > > > > prefix of the node <my:person>David</my:person>.
> > > > >
> > > > > The call to DOM_Node::getPrefix() always returns NULL, while I
> > > >understand
> > > > > that it should return "my". However, the call to
> > > >DOM_Node::getNamespaceURI()
> > > > > does return the correct value "http://david.com/david-schema".
> > > > >
> > > > > Some guidance on how to get the prefix would be appreciated.
> > > > >
> > > > > Best regards,
> > > > > David Ruana
> > > > >
> > > > > --------------- File david3.xsd
> > > > >
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > > xmlns:my="http://david.com/david-schema"
> > > > > targetNamespace="http://david.com/david-schema">
> > > > >
> > > > > <xs:element name="addressbook">
> > > > > <xs:complexType>
> > > > > <xs:sequence>
> > > > > <xs:element ref="my:person" minOccurs='1'
> >maxOccurs='unbounded'/>
> > > > > </xs:sequence>
> > > > > </xs:complexType>
> > > > > </xs:element>
> > > > >
> > > > > <xs:element name="person" type="xs:string"/>
> > > > >
> > > > > </xs:schema>
> > > > >
> > > > > --------------- File david3.xml
> > > > >
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <my:addressbook
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > > xmlns:my="http://david.com/david-schema"
> > > > > xsi:schemaLocation="http://david.com/david-schema
> > > david3.xsd">
> > > > >
> > > > > <my:person>David</my:person>
> > > > > </my:addressbook>
> > > > >
> > > > >
> > > > >
> > > > > _________________________________________________________________
> > > > > Descargue GRATUITAMENTE MSN Explorer en
> > > > > http://explorer.yupimsn.com/intl.asp.
> > > > >
> > > > >
> > > > >
> >---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >--
> > > >Gareth Reakes, Head of Product Development
> > > >DecisionSoft Ltd. http://www.decisionsoft.com
> > > >Office: +44 (0) 1865 203192
> > > >
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > >For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > >
> > >
> > >
> > >
> > > _________________________________________________________________
> > > �nase con MSN Hotmail al servicio de correo electr�nico m�s grande del
> > > mundo. http://www.hotmail.com
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
>
> _________________________________________________________________
> Descargue GRATUITAMENTE MSN Explorer en
> http://explorer.yupimsn.com/intl.asp.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Gareth Reakes, Head of Product Development
DecisionSoft Ltd. http://www.decisionsoft.com
Office: +44 (0) 1865 203192
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]