OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Parsing Attibute Values containing "." in a Schema

[ Lists Home | Date Index | Thread Index ]

It's not obvious (to me) from your code why you would get the odd 
results you described, but there is still a lot of missing information. 
Like, what version of the JRE are you running? Have you installed your 
own parser and/or jaxp or is it pre-installed (as in 1.4)? Have you set 
the system properties (e.g., org.xml.sax.driver) that change the default 
parser selection?

You can save yourself some time. If you come back and say you are using 
Sun's JRE 1.4 with the default parser and the application as stated, 
people will tend not to believe that it (either Crimson or Xerces) will 
behave as you report, which will not be helpful. If you are using a 
different parser, try it with the default parser.

Bob Foster

Marcus Robinson wrote:
 > The code that sets up the parser is as follows:
 >
 >       XMLReader parser = XMLReaderFactory.createXMLReader();
 >         parser.setEntityResolver(new XSDEntityResolver());
 >         parser.setFeature("http://xml.org/sax/features/validation";, 
true);
 >
 > parser.setFeature("http://apache.org/xml/features/validation/schema";, 
true);
 >
 > 
parser.setFeature("http://apache.org/xml/features/validation/schema-full-che
 > cking", true);
 >
 > parser.setFeature("http://xml.org/sax/features/namespace-prefixes",true);
 >
 > 
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
 >                            "http://www.w3.org/2001/XMLSchema";);
 >
 > 
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";,
 >                            "http://www.w3.org/2001/XMLSchema.xsd";);
 >        ImportSchemaHandler ish = new ImportSchemaHandler(this);
 >        parser.setContentHandler(ish);
 >
 >        InputStream is = new FileInputStream(schemaFile);
 >        parser.parse(new InputSource(is));
 >
 > Using parser: org.xml.sax.XMLReader
 >
 > In the handler I am then using attributes.getValue("name") in the
 > startElement method to retrieve the attribute value.
 >
 > If any more information is needed let me know, thanks for the help,
 >
 > Marcus Robinson
 >
 > ----- Original Message -----
 > From: "Michael Kay" <michael.h.kay@ntlworld.com>
 > To: "'Marcus Robinson'" <marcus@mrict.co.uk>; <xml-dev@lists.xml.org>
 > Sent: Thursday, March 25, 2004 5:54 PM
 > Subject: RE: [xml-dev] Parsing Attibute Values containing "." in a Schema
 >
 >
 >
 >>There's obviously something wrong either with your code or with your
 >
 > parser,
 >
 >>but since you haven't shown us your code or identified your parser it's
 >
 > hard
 >
 >>to see how anyone can help you.
 >>
 >>Michael Kay
 >>
 >># -----Original Message-----
 >># From: Marcus Robinson [mailto:marcus@mrict.co.uk]
 >># Sent: 25 March 2004 16:41
 >># To: xml-dev@lists.xml.org
 >># Subject: [xml-dev] Parsing Attibute Values containing "." in a Schema
 >>#
 >># Hi, Can anyone help me?
 >>#
 >># I am trying to parse an XML schema in Java using an
 >># XMLReader. All is well apart from:
 >>#
 >># When I parse:
 >># "<xsd:attributeGroup name="attr.identifierref">"
 >>#
 >># And use attribute.getValue"name", I get "identifierref".
 >>#
 >># When I parse the element:
 >># " <xsd:attributeGroup name="attr.identifierref.req">"
 >>#
 >># I also get "identifierref". The ".req" is lost.
 >>#
 >>#  I want to get the full value, i.e. "attr.identifierref.req"
 >># or attr."identifierref" , or even just "identifierref" and
 >># "identifierref.req"
 >># . Is there a feature or property that is set incorrectly, or
 >># is this not possible? The reason I want to do this is when
 >># parsing the XML I want to link an attribute back to the
 >># schema, but an attribute "identifierref" will refer two two
 >># attributes rather than just the correct one.
 >>#
 >># Many thanks in adavance,
 >>#
 >># Marcus Robinson





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS