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 ]

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
> #
> #
> #
> # -----------------------------------------------------------------
> # The xml-dev list is sponsored by XML.org
> # <http://www.xml.org>, an initiative of OASIS
> # <http://www.oasis-open.org>
> #
> # The list archives are at http://lists.xml.org/archives/xml-dev/
> #
> # To subscribe or unsubscribe from this list use the subscription
> # manager: <http://www.oasis-open.org/mlmanage/index.php>
> #
>
>






 

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

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