|
RE: Prefix question: msg#00088text.xml.xmlbeans.user
hehe... yeah, conscious decision is probably the phrase I was after. thanks Radu, case closed (o: -----Original Message----- From: Radu Preotiuc-Pietro [mailto:radup@xxxxxxx] Sent: Thursday, 13 January 2005 7:48 AM To: user@xxxxxxxxxxxxxxxxxxx Subject: RE: Prefix question I wouldn't name it a "strategic" decision :-) But yeah, it was a conscious decision and has to do with the fact that it is important to keep the size of the binary file as small as possible and we store quite a few QNames in there. In the future, if I ever get to redesigning the format for the binary files, I'll keep it in mind that it might be useful to save the prefix information, but it doesn't sound super-interesting to me. Radu -----Original Message----- From: Dmitri.Colebatch@xxxxxxxxxxxxx [mailto:Dmitri.Colebatch@xxxxxxxxxxxxx] Sent: Tuesday, January 11, 2005 2:53 PM To: user@xxxxxxxxxxxxxxxxxxx Subject: RE: Prefix question Dogan, Firstly, I'm assuming that you're asking this question more out of interest than anything else. Secondly, I'm not a developer on the xmlbeans project, but from what I can see (looking at the source for 1.0.3) the name (QName) on SchemaPropertyImpl is set by SchemaTypeSystemImpl.readQName which looks like: QName readQName() { String namespace = readString(); String localname = readString(); if (localname == null) return null; return new QName(namespace, localname); } so it just isn't reading (and hence populating) the prefix that the namespace was declared with. I assume this is a small oversight on the developers' part, of they just considered it not worth implementing. that answer your query? perhaps one of the developers familiar with that area of the codebase could answer if this is a strategic decision or an oversight. cheers dim -----Original Message----- From: Jacob Danner [mailto:jacobd@xxxxxxx] Sent: Wednesday, 12 January 2005 9:49 AM To: user@xxxxxxxxxxxxxxxxxxx Subject: RE: Prefix question I thought that the attribute xmlns:ga="http://ga.afl.com/" in the <xs:schema> tag reflects that. Isn't that true? Nope, that just declares a namespace. AFAIK, there's is no way within an XSD to require an element be qualified using a prefix. I also thought most parsers would consider this <readGroupRequest xmlns="http://ga.afl.com/"> and <ga:readGroupRequest xmlns:ga="http://ga.afl.com/"> to be the same. Why does the XML need to have this prefix? Also, I'm not sure setSaveSuggestedPrefixes will do what you need, try, setAggressivePrfixes (?) -----Original Message----- From: Dogan Atay [mailto:DAtay@xxxxxxxxx] Sent: Tue 1/11/2005 2:30 PM To: user@xxxxxxxxxxxxxxxxxxx Cc: Subject: RE: Prefix question Justin, I think I have asked my question in a wrong way. My application is NOT dependent on 'ga' prefix. The output xml of <readGroupRequest xmlns="http://ga.afl.com/"> <groupNumber>12345</groupNumber> </readGroupRequest> is namespace qualified with a no-prefix. That is fine. My schema shows that this namespace is qualified with the 'ga' prefix. I thought that the attribute xmlns:ga="http://ga.afl.com/" in the <xs:schema> tag reflects that. Isn't that true? My question is that when I call getName().getPrefix() for this QName why is 'ga' not shown? Thanks, Dogan Atay _____ Parsers are free to choose their own prefixes (or none at all). Why is your application dependent on the prefix "ga"? The URI to which this prefix points is what's important, not the prefix itself. - Justin From: Dogan Atay Sent: Tuesday, January 11, 2005 4:46 PM To: user@xxxxxxxxxxxxxxxxxxx Subject: Prefix question I have a schema like the following <xs:schema targetNamespace="http://ga.afl.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:ga="http://ga.afl.com/" xmlns:png="http://ga.afl.com/png/" xmlns:pnr="http://ga.afl.com/pnr/" xmlns:ct="http://es.afl.com/ct/"> <xs:import namespace=http://es.aflc.com/ct/ schemaLocation="ct.xsd"/> <xs:import namespace="http://ga.afl.com/png/" schemaLocation="Png.xsd"/> <xs:import namespace="http://ga.afl.com/pnr/" schemaLocation="Pnr.xsd"/> <xs:element name="readGroupRequest" type="ga:GroupIdentifierType"/> <xs:complexType name="GroupIdentifierType"> <xs:choice> <xs:element name="pngId" type="xs:integer"/> <xs:element name="batchId" type="png:BatchIDType"/> <xs:element name="groupNumber" type="ct:GroupNumberType"/> </xs:choice> </xs:complexType> </xs:schema> After the schema is compiled I do the following SchemaType type = ReadGroupRequestDocument.type; SchemaProperty[] schemaProperties = type.getElementProperties(); for(int i=0; i < schemaProperties.length; i++) { SchemaProperty schemaProperty = schemaProperties[i]; QName qName = schemaProperty.getName(); System.out.println("NamespaceURI: " + qName.getNamespaceURI()); System.out.println("LocalPart: " + qName.getLocalPart()); System.out.println("Prefix: " + qName.getPrefix()); } The output of that code is NamespaceURI: http://ga.afl.com/ LocalPart: readGroupRequest Prefix: What I do not understand is why the prefix is not "ga". The schema has this information. I need to get this information out of the schema because the xml I generate must have this prefix. I will use XMLOptions setSaveSuggestedPrefixes() method but I do not want to hardcode a prefix in my source code. How else can I get the prefix from the schema? Thanks, Dogan Atay ###################################################################### DISCLAIMER: This email and any attachment may contain confidential information. If you are not the intended recipient you are not authorized to copy or disclose all or any part of it without the prior written consent of Toyota. Opinions expressed in this email and any attachments are those of the sender and not necessarily the opinions of Toyota. Please scan this email and any attachment(s) for viruses. Toyota does not accept any responsibility for problems caused by viruses, whether it is Toyota's fault or not. ###################################################################### --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx ###################################################################### DISCLAIMER: This email and any attachment may contain confidential information. If you are not the intended recipient you are not authorized to copy or disclose all or any part of it without the prior written consent of Toyota. Opinions expressed in this email and any attachments are those of the sender and not necessarily the opinions of Toyota. Please scan this email and any attachment(s) for viruses. Toyota does not accept any responsibility for problems caused by viruses, whether it is Toyota's fault or not. ###################################################################### |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Prefix question: 00088, Radu Preotiuc-Pietro |
|---|---|
| Next by Date: | ant task questions: 00088, Zac Jacobson |
| Previous by Thread: | RE: Prefix questioni: 00088, Radu Preotiuc-Pietro |
| Next by Thread: | ant task questions: 00088, Zac Jacobson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |