logo       

Re: XML Schema and Xerces 2-J: msg#00038

Subject: Re: XML Schema and Xerces 2-J
Sorry forgot to attach the xml and schema file for the same. And found the answer for first one. SchemaGrammer as name indicates is constructed from XML Schema.
 
But second one is still unclear why this strange  behavior!
 
Thanks
 
-Huzefa
Huzefa Hakimi <hakimi_dev@xxxxxxxxx> wrote:
Hi folks,

I had couple of doubts regarding XML Schema Processing
processing.

1. When validation is turned on, does the
SchemaGrammer which is been loaded is the grammer
constructed from XML Schema or is it directly
constructed from XML Document without parsing XML
Schema.

2. Secondly I am assuming the SchemaGrammer is
constructed from XML Schema defined in XML Document.
I am trying to gather information about all the
elements and attributes defined in Schema which are
also present in XML Document. Problem comes when I try
to collect information about attributes present from
XSModel instance obtained from ElementPSVI, it returns
no attribute information. Although both in Schema and
XML document the attributes are defined. below is code
snippet I am using to achieve this. Can anyone help me
out in figuring out the problem.

-----------------------------------------------------

ElementPSVI elementPSVI =
psviProvider.getElementPSVI();
XSModel xsmodel = elementPSVI.getSchemaInformation();

// This works fine for Element information

XSNamedMap xsMap =
xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION);

for(int i = 0; i < xsMap.getLength(); i++){

String name = xsMap.item(i).getName();
.
.
.
}

// But when try to get information about attributes
// it does not get "any" attribute information

xsMap =
xsmodel.getComponents(XSConstants.ATTRIBUTE_DECLARATION);

for(int i = 0; i < xsMap.getLength(); i++){
String name = xsMap.item(i).getName();
.
.
.
}
....

-----------------------------------------------------

Thanks for going through this and getting involved.

-Huzefa
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: xerces-j-user-help@xxxxxxxxxxxxxx


Do you Yahoo!?
Free Pop-Up Blocker - Get it now
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

 <xs:element name="personnel">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/>
   </xs:sequence>
  </xs:complexType>

  <xs:unique name="unique1">
   <xs:selector xpath="person"/>
   <xs:field xpath="name/given"/>
   <xs:field xpath="name/family"/>
  </xs:unique>
  <xs:key name='empid'>
   <xs:selector xpath="person"/>
   <xs:field xpath="@id"/>
  </xs:key>
  <xs:keyref name="keyref1" refer='empid'>
   <xs:selector xpath="person"/> 
   <xs:field xpath="link/@manager"/>  
  </xs:keyref>

 </xs:element>

 <xs:element name="person">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="name"/>
     <xs:element ref="email" minOccurs='0' maxOccurs='unbounded'/>
     <xs:element ref="url"   minOccurs='0' maxOccurs='unbounded'/>
     <xs:element ref="link"  minOccurs='0' maxOccurs='1'/>
   </xs:sequence>
   <xs:attribute name="id"  type="xs:ID" use='required'/>
   <xs:attribute name="note" type="xs:string"/>
   <xs:attribute name="contr" default="false">
    <xs:simpleType>
     <xs:restriction base = "xs:string">
       <xs:enumeration value="true"/>
       <xs:enumeration value="false"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:attribute>
   <xs:attribute name="salary" type="xs:integer"/>
  </xs:complexType>
 </xs:element>

 <xs:element name="name">
  <xs:complexType>
   <xs:all>
    <xs:element ref="family"/>
    <xs:element ref="given"/>
   </xs:all>
  </xs:complexType>
 </xs:element>

 <xs:element name="family" type='xs:string'/>

 <xs:element name="given" type='xs:string'/>

 <xs:element name="email" type='xs:string'/>

 <xs:element name="url">
  <xs:complexType>
   <xs:attribute name="href" type="xs:string" default="http://"/>
  </xs:complexType>
 </xs:element>

 <xs:element name="link">
  <xs:complexType>
   <xs:attribute name="manager" type="xs:IDREF"/>
   <xs:attribute name="subordinates" type="xs:IDREFS"/>
  </xs:complexType>
 </xs:element>

 <xs:notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>

</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:noNamespaceSchemaLocation='personal.xsd'>

  <person id="Big.Boss" >
    <name><family>Boss</family>  </name>
   <email>chief@xxxxxxx</email>
    <link subordinates="one.worker two.worker three.worker four.worker 
five.worker"/>
  </person>

  <person id="one.worker">
    <name><family>Worker</family>     </name>
<email>one@xxxxxxx</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="two.worker">
    <name><family>Worker</family>     </name>
<email>two@xxxxxxx</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="three.worker">
    <name><family>Worker</family>     </name>
<email>three@xxxxxxx</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="four.worker">
    <name><family>Worker</family>     </name>
<email>four@xxxxxxx</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="five.worker">
    <name><family>Worker</family>     </name>
<email>five@xxxxxxx</email>
    <link manager="Big.Boss"/>
  </person>

</personnel>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: xerces-j-user-help@xxxxxxxxxxxxxx
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe