  | |  | RES: Can´t acess child elements definition | RES: Can´t acess child elements definition 2003-10-07 - By Maksym Kovalenko
set the following property
// The fully qualified name of the class implementing the org.w3c.dom.Document interface. // The implementation used must have a zero argument constructor. // org.apache.xerces.dom.PSVIDocumentImpl - Apache document implementation, // which knows how to create an element with PSVI information. // PSVI - post schema validation infoset parser.setProperty("http://apache.org/xml/properties/dom/document-class-name", "org.apache.xerces.dom.PSVIDocumentImpl");
it's all in xerces' howtos. next time look harder, especially xni sections
Rubens Del Monte wrote:
> Max (and anybody who can help me), > > > > I tried out that but it result in a java.lang.ClassCastException.. > the code is this : > > > > XMLParserConfiguration config = new StandardParserConfiguration(); > > > config.setProperty("http://apache.org/xml/properties/internal/grammar-pool" ,grammarPool); > > DOMParser parser = new DOMParser(config); > > > parser.setFeature("http://xml.org/sax/features/validation",true); > > > parser.setFeature("http://apache.org/xml/features/validation/schema",true); > > parser.parse(filename); > > doc = parser.getDocument(); > > > > org.apache.xerces.impl.xs.psvi.XSModel model = > grammarPool.toXSModel(); > > > > XSElementDeclaration elem = ((XSModelImpl) > model).getElementDeclaration("os",null); > > > > // this line ocurrs the exception.. the > XSElementDeclaration cannot be casted into a ((ElementPSVI > > XSElementDeclaration elemson = ((ElementPSVI) > elem).getElementDeclaration(); > > > > I ´ve been looking into the xerces documentation but I still havent > found a way to get the XSElementDeclaration that are child of a > XSElementDeclaration. > > > > Thanks, > > > > Rubens Del Monte > > > > > > > > -----Mensagem original----- > De: Maksym Kovalenko [mailto:mkovalenko@(protected)] > Enviada em: terça-feira, 7 de outubro de 2003 16:53 > Para: xerces-j-user@(protected) > Assunto: Re: Can´t acess child elements definition > > > > For child element you can extract its declaration as the following > > XSElementDeclaration elDecl = ((ElementPSVI) > childElement).getElementDeclaration(); > > The error in the code you've provided is that to get element > declaration for child elements you need to process content of the root > element. > model.getComponents(XSConstants.ELEMENT_DECLARATION); contains only > information for elements defined in the schema's top level. > > Max > > Rubens Del Monte wrote: > > Hello, > > I´m starting to develop an application with Xerces and I´m having > some trouble acessing the validation information of child nodes. > > My code is the following : > > ... > > XMLParserConfiguration config = new StandardParserConfiguration(); > > // the pool is empty, but the schema is loaded when parsed, and the > validation occurs > > > config.setProperty("http://apache.org/xml/properties/internal/grammar-pool" > <http://apache.org/xml/properties/internal/grammar-pool>,grammarPool); > > DOMParser parser = new DOMParser(config); > > parser.setFeature("http://xml.org/sax/features/validation" > <http://xml.org/sax/features/validation>,true); > > > parser.setFeature("http://apache.org/xml/features/validation/schema" > <http://apache.org/xml/features/validation/schema>,true); > > parser.parse(filename); > > doc = parser.getDocument(); > > > > org.apache.xerces.impl.xs.psvi.XSModel model = > grammarPool.toXSModel(); > > // the only element this brings is the root node > > XSNamedMap element = > model.getComponents(XSConstants.ELEMENT_DECLARATION); > > // I first tried this, but it only works with the root element, none > of the others. They don´t have namespace too... > > XSElementDeclaration elem = ((XSModelImpl) > model).getElementDeclaration("os",null); > > .... > > If anyone can help me, please, I´ve been trying to do this but it´s > taking too long... > > Thanks, > > Rubens Del Monte > > > > -- > > ------------------------------------------------------------------------ > > Maksym Kovalenko > Software Engineer > Marketswitch Corporation > http://www.marketswitch.com <http://www.marketswitch.com/> > 108 Powers Court, Suite 225 > Dulles, VA 20166 > Phone: +1 (703) 444-6750 ext. 302 > Fax: +1 (703) 444-6812 >
-- ------------------------------------------------------------------------
Maksym Kovalenko Software Engineer Marketswitch Corporation http://www.marketswitch.com <http://www.marketswitch.com/> 108 Powers Court, Suite 225 Dulles, VA 20166 Phone: +1 (703) 444-6750 ext. 302 Fax: +1 (703) 444-6812
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> set the following property<br> <br> // The fully qualified name of the class implementing the org.w3c.dom.Document interface.<br> // The implementation used must have a zero argument constructor.<br> // org .apache.xerces.dom.PSVIDocumentImpl - Apache document implementation,<br> // which knows how to create an element with PSVI information.<br> // PSVI - post schema validation infoset<br> parser.setProperty(<a class="moz-txt-link-rfc2396E" href="http://apache.org/xml /properties/dom/document-class-name">"http://apache.org/xml/properties/dom /document-class-name"</a>,<br> "org.apache.xerces.dom.PSVIDocumentImpl"); <br> <br> it's all in xerces' howtos. next time look harder, especially xni sections<br> <br> <br> Rubens Del Monte wrote:<br> <blockquote type="cite" cite="midDOEMJBAACOAOGLBIJGDFIEBKCBAA.rubens@(protected)"> <meta http-equiv="Content-Type" content="text/html; "> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 9"> <meta name="Originator" content="Microsoft Word 9"> <link rel="File-List" href="cid:filelist.xml@(protected)"> <link rel="Edit-Time-Data" href="cid:editdata.mso@(protected)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title> </title> <!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:DoNotRelyOnCSS/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>0</w:Zoom> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:HyphenationZone>21</w:HyphenationZone> <w:EnvelopeVis/> </w:WordDocument> </xml><![endif]--> <style> <!-- /* Font Definitions */ @(protected) {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:1627421319 -2147483648 8 0 66047 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:black;} p.MsoListBullet, li.MsoListBullet, div.MsoListBullet {mso-style-update:auto; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:18.0pt; margin-bottom:.0001pt; text-indent:-18.0pt; mso-pagination:widow-orphan; mso-list:l0 level1 lfo3; tab-stops:list 18.0pt 36.0pt; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:black;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig {margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:black;} span.EstiloDeCorreioEletrnico15 {mso-style-type:personal; mso-ansi-font-size:10.0pt; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:black;} span.EstiloDeCorreioEletrnico20 {mso-style-type:personal-reply; mso-ansi-font-size:10.0pt; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:navy;} @(protected) Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @(protected) l0 {mso-list-id:1267425083; mso-list-template-ids:1342363324;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} --> </style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1027"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> <div class="Section1"> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">Max (and anybody who can help me),<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span><span style=""> </span>I tried out that but it result in a java.lang.ClassCastException.. the code is this :<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal" style="text-indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">XMLParserConfiguration config = new StandardParserConfiguration();<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>config.setProperty(<a class="moz-txt-link-rfc2396E" href="http:/ /apache.org/xml/properties/internal/grammar-pool">"http://apache.org/xml /properties/internal/grammar-pool"</a>,grammarPool);<o:p></o:p></span></font>< /span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>DOMParser parser = new DOMParser(config);<o:p></o:p></span></font>< /span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>parser.setFeature(<a class="moz-txt-link-rfc2396E" href="http://xml .org/sax/features/validation">"http://xml.org/sax/features/validation"</a>,true) ;<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>parser.setFeature(<a class="moz-txt-link-rfc2396E" href="http://apache .org/xml/features/validation/schema">"http://apache.org/xml/features/validation /schema"</a>,true);<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>parser.parse(filename);<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>doc = parser.getDocument();<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span><span style=""> </span><o:p></o:p></span>< /font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>org.apache.xerces.impl.xs.psvi.XSModel model = grammarPool.toXSModel();<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>XSElementDeclaration elem = ((XSModelImpl) model).getElementDeclaration("os",null);<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>// this line ocurrs the exception.. the XSElementDeclaration cannot be casted into a ((ElementPSVI<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><span style=""> </span>XSElementDeclaration elemson = ((ElementPSVI) elem).getElementDeclaration();<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">I ´ve been looking into the xerces documentation but I still havent found a way to get the XSElementDeclaration that are child of a XSElementDeclaration.<o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">Thanks,<o:p></o:p></span></font>< /span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">Rubens Del Monte<o:p></o:p></span ></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal"><span class="EstiloDeCorreioEletrnico20"><font size="2" color="navy" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></span></p> <p class="MsoNormal" style="margin-left: 35.4pt;"><font size="2" color="black" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;">-----Mensagem original-----<br> <b><span style="font-weight: bold;">De:</span></b> Maksym Kovalenko [<a class="moz-txt-link-freetext" href="mailto:mkovalenko@(protected)" >mailto:mkovalenko@(protected)</a>]<br> <b><span style="font-weight: bold;">Enviada em:</span></b> terça-feira, 7 de outubro de 2003 16:53<br> <b><span style="font-weight: bold;">Para:</span></b> <a class="moz-txt-link-abbreviated" href="mailto:xerces-j-user@(protected)" >xerces-j-user@(protected)</a><br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: Can´t acess child elements definition </span></font></p> <p class="MsoNormal" style="margin-left: 35.4pt;"><font size="3" color="black" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> <p class="MsoNormal" style="margin-left: 35.4pt;"><font size="3" color="black" face="Times New Roman"><span lang="EN-US" style="font-size: 12pt;">For child element you can extract its declaration as the following<br> <br> XSElementDeclaration elDecl = ((ElementPSVI) childElement).getElementDeclaration();<br> <br> The error in the code you've provided is that to get element declaration for child elements you need to process content of the root element.<br> </span></font><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">model.getComponents(XSConstants .ELEMENT_DECLARATION); contains only information for elements defined in the schema's top level.</span></font></span><font size="2" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><br> <br> <span class="EstiloDeCorreioEletrnico15"><font color="black">Max</font></span ><br> </span></font><span lang="EN-US" style=""><br> Rubens Del Monte wrote:<br style=""> <!--[if !supportLineBreakNewLine]--><br style=""> <!--[endif]--><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><!--[if gte mso 9]><xml> <u1:OfficeDocumentSettings> <u1:DoNotRelyOnCSS/> </u1:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <u2:WordDocument> <u2:View>Normal</u2:View> <u2:Zoom>0</u2:Zoom> <u2:DocumentKind>DocumentEmail</u2:DocumentKind> <u2:HyphenationZone>21</u2:HyphenationZone> <u2:EnvelopeVis/> </u2:WordDocument> </xml><![endif]-->Hello, <u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p>< /span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> I´m starting to develop an application with Xerces and I´m having some trouble acessing the validation information of child nodes.<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">My code is the following :<u3:p>< /u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><u3:p></u3:p>…<u3:p></u3:p> </span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">XMLParserConfiguration config = new StandardParserConfiguration();<u3:p></u3:p></span></font></span> <span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">// the pool is empty, but the schema is loaded when parsed, and the validation occurs<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> config.setProperty(<a href="http://apache.org/xml/properties/internal/grammar-pool">"http://apache .org/xml/properties/internal/grammar-pool"</a>,grammarPool); <u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p>< /span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> DOMParser parser = new DOMParser(config);<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> parser.setFeature(<a href="http://xml.org/sax/features/validation">"http://xml .org/sax/features/validation"</a>,true);<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> parser.setFeature(<a href="http://apache.org/xml/features/validation/schema">"http://apache.org/xml /features/validation/schema"</a>,true);<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> parser.parse(filename);<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> doc = parser.getDocument();<u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> <u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p>< /span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> org.apache.xerces.impl.xs.psvi.XSModel model = grammarPool.toXSModel(); <u3:p></u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"> // the only element this brings is the root node<u3:p></u3:p></span></font>< /span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">XSNamedMap element = model.getComponents(XSConstants.ELEMENT_DECLARATION); <u3:p></u3:p>< /span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">// I first tried this, but it only works with the root element, none of the others. They don´t have namespace too…<u3:p>< /u3:p></span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">XSElementDeclaration elem = ((XSModelImpl) model).getElementDeclaration("os",null);<u3:p></u3:p>< /span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">….<u3:p></u3:p></span>< /font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><u3:p></u3:p>If anyone can help me, please, I´ve been trying to do this but it´s taking too long…<u3:p></u3:p></span>< /font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;"><u3:p></u3:p>Thanks,<u3:p></u3:p> </span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-right: 36pt; margin-left: 71.4pt; margin-bottom: 0.0001pt; text -indent: 35.4pt;"><span class="EstiloDeCorreioEletrnico15"><u3:p></u3:p><font size="2" color="black" face="Arial"><span lang="EN-US" style="font-size: 10pt; font-family: Arial;">Rubens Del Monte<u3:p></u3:p>< /span></font></span><span lang="EN-US" style=""><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 35.4pt;"><font size="3" color="black" face="Times New Roman"><span lang="EN-US" style="font-size: 12pt;"><u3:p></u3:p><!--[if !supportEmptyParas]--> <!-- [endif]--><o:p></o:p></span></font></p> <p class="MsoNormal" style="margin-left: 35.4pt;"><font size="3" color="black" face="Times New Roman"><span style="font-size: 12pt;">-- <br style=""> <!--[if !supportLineBreakNewLine]--><br style=""> <!--[endif]--><o:p></o:p></span></font></p> <!--[if gte mso 9]><xml> <u3:DocumentProperties> <u3:Author>Maksym Kovalenko</u3:Author> <u3:Template>Normal</u3:Template> <u3:LastAuthor>Maksym Kovalenko</u3:LastAuthor> <u3:Revision>5</u3:Revision> <u3:TotalTime>12</u3:TotalTime> <u3:Created>2002-07-18T15:33:00Z</u3:Created> <u3:LastSaved>2002-07-18T15:46:00Z</u3:LastSaved> <u3:Pages>1</u3:Pages> <u3:Words>29</u3:Words> <u3:Characters>170</u3:Characters> <u3:Company>Marketswitch Corporation</u3:Company> <u3:Lines>1</u3:Lines> <u3:Paragraphs>1</u3:Paragraphs> <u3:CharactersWithSpaces>208</u3:CharactersWithSpaces> <u3:Version>9.4402</u3:Version> </u3:DocumentProperties> </xml><![endif]--> <div class="MsoNormal" align="center" style="margin-left: 38.85pt; text-align: center;"><font size="2" color="gray" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; color: gray;"> <hr size="2" width="100%" align="center"></span></font></div> <p class="MsoNormal" style="margin-left: 38.85pt;"><font size="2" color="gray" face="Tahoma"><span lang="EN-US" style="font-size: 10pt; font-family: Tahoma; color: gray;">Maksym Kovalenko<br> Software Engineer<br> Marketswitch Corporation<br> </span></font><font size="2" color="gray" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; color: gray;"><a href="http://www.marketswitch.com/"><span lang="EN-US" style="">http://www .marketswitch.com</span></a></span></font><font size="2" color="gray" face="Tahoma"><span lang="EN-US" style="font-size: 10pt; font-family: Tahoma; color: gray;"><br> 108 Powers Court, Suite 225<br> Dulles, VA 20166<br> Phone: +1 (703) 444-6750 ext. 302<br> Fax: +1 (703) 444-6812</span></font><span lang="EN-US" style=""><o:p></o:p>< /span></p> </div> </blockquote> <br> <div class="moz-signature">-- <br> <meta http-equiv="Content-Type" content="text/html; "> <meta name="ProgId" content="Word.Document"> <meta name="Generator" content="Microsoft Word 9"> <meta name="Originator" content="Microsoft Word 9"> <link rel="File-List" href="./MarketSwitch%20Signature_files/filelist.xml"> <link rel="Edit-Time-Data" href="./MarketSwitch%20Signature_files/editdata.mso"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title> </title> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Maksym Kovalenko</o:Author> <o:Template>Normal</o:Template> <o:LastAuthor>Maksym Kovalenko</o:LastAuthor> <o:Revision>5</o:Revision> <o:TotalTime>12</o:TotalTime> <o:Created>2002-07-18T15:33:00Z</o:Created> <o:LastSaved>2002-07-18T15:46:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>29</o:Words> <o:Characters>170</o:Characters> <o:Company>Marketswitch Corporation</o:Company> <o:Lines>1</o:Lines> <o:Paragraphs>1</o:Paragraphs> <o:CharactersWithSpaces>208</o:CharactersWithSpaces> <o:Version>9.4402</o:Version> </o:DocumentProperties> </xml><![endif]--> <style> <!-- /* Font Definitions */ @(protected) {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:204; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:553679495 -2147483648 8 0 66047 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p.MsoListBullet, li.MsoListBullet, div.MsoListBullet {mso-style-update:auto; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.25in; margin-bottom:.0001pt; text-indent:-.25in; mso-pagination:widow-orphan; mso-list:l0 level1 lfo3; tab-stops:list .25in; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @(protected) l0 {mso-list-id:-119; mso-list-type:simple; mso-list-template-ids:-1257969266;} @(protected) l0:level1 {mso-level-number-format:bullet; mso-level-style-link:"List Bullet"; mso-level-text:\F0B7; mso-level-tab-stop:.25in; mso-level-number-position:left; margin-left:.25in; text-indent:-.25in; font-family:Symbol;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <div class="Section1"> <div class="MsoNormal" align="center" style="margin-left: 3.45pt; text-align: center;"><span style="font-size: 10pt; font-family: Tahoma; color: gray;"> <hr size="2" width="100%" align="center"></span></div> <p class="MsoNormal" style="margin-left: 3.45pt;"><span style="font-size: 10pt; font-family: Tahoma; color: gray;">Maksym Kovalenko<br> Software Engineer<br> Marketswitch Corporation<br> <a href="http://www.marketswitch.com/">http://www.marketswitch.com</a><br> 108 Powers Court, Suite 225<br> Dulles, VA 20166<br> Phone: +1 (703) 444-6750 ext. 302<br> Fax: +1 (703) 444-6812</span></p> </div> </div> </body> </html>
|
|
 |