You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Eric Fedok <er...@synchronoss.com> on 2004/06/10 16:36:09 UTC

default values for elements

If I have an xsd of:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
    <xs:element name="a">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="b" minOccurs="0" default="thisisb"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

and an xml file of:
<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="file:/pathto/a.xsd">
</a>

and I am parsing the document using the SAX parser with features of:
http://xml.org/sax/features/validation        
http://apache.org/xml/features/validation/schema
http://xml.org/sax/features/namespaces        
http://apache.org/xml/features/validation/schema/element-default

I would expect the parser to "find" an element b with a value of
thisisb, however, I do not seem to get any reference to element b in the
startElement or characters methods of my handler.  Is this a bug or am I
misunderstanding the purpose of
http://apache.org/xml/features/validation/schema/element-default?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: default values for elements

Posted by Eric Fedok <er...@synchronoss.com>.
Ah thats the trick, I misunderstood, Thank You.

On Thu, 2004-06-10 at 10:57, Neil Delima wrote:
> 
> 
> When the feature
> http://apache.org/xml/features/validation/schema/element-default is
> enabled, the default value of the element is reported via the characters()
> callback.  Add an empty element "b" to get this value.
> 
> 
> Eric Fedok <er...@synchronoss.com> wrote on 06/10/2004 10:36:09 AM:
> 
> > If I have an xsd of:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
> >     <xs:element name="a">
> >         <xs:complexType>
> >             <xs:sequence>
> >                 <xs:element name="b" minOccurs="0" default="thisisb"/>
> >             </xs:sequence>
> >         </xs:complexType>
> >     </xs:element>
> > </xs:schema>
> >
> > and an xml file of:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >  xsi:noNamespaceSchemaLocation="file:/pathto/a.xsd">
> > </a>
> >
> > and I am parsing the document using the SAX parser with features of:
> > http://xml.org/sax/features/validation
> > http://apache.org/xml/features/validation/schema
> > http://xml.org/sax/features/namespaces
> > http://apache.org/xml/features/validation/schema/element-default
> >
> > I would expect the parser to "find" an element b with a value of
> > thisisb, however, I do not seem to get any reference to element b in the
> > startElement or characters methods of my handler.  Is this a bug or am I
> > misunderstanding the purpose of
> > http://apache.org/xml/features/validation/schema/element-default?
> >
> > Thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: html encoded attributes

Posted by "F. Andy Seidl" <fa...@myst-technology.com>.
Take a look at the disable-output-escaping attribute available on xsl:text
and xsl:value-of.  I believe you can do what you want with
disable-output-escaping='yes'.  One caution: disable-output-escaping is an
optional XSL feature--not all XSLT processors support it (notably
Microsoft's) but I use it often with Xalan.
  -- fas
F. Andy Seidl
MyST Technology Partners

|-----Original Message-----
|From: Robert van Loenhout [mailto:r.vanloenhout@greenvalley.nl]
|Sent: Thursday, June 10, 2004 11:10 AM
|To: xerces-j-user@xml.apache.org
|Subject: html encoded attributes
|
|Hi,
|
|I was curious if there was some way to create html with an xsl that can
|decode the value of an xml attribute and outputs it in the document.
|So for example if the xml document contains:
|<text value="&lt;h1>hello world!&lt;h1>"/>
|
|I would like the xsl to output:
|<html>
|<body>
|  <h1>hello world!</h1>
|</body>
|</html>
|
|I think the answer is no, but I want to make sure :)
|
|
|
|
|
|
|
|
|
|
|
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
|For additional commands, e-mail: xerces-j-user-help@xml.apache.org
|



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


html encoded attributes

Posted by Robert van Loenhout <r....@greenvalley.nl>.
Hi,

I was curious if there was some way to create html with an xsl that can
decode the value of an xml attribute and outputs it in the document.
So for example if the xml document contains:
<text value="&lt;h1>hello world!&lt;h1>"/>

I would like the xsl to output:
<html>
<body>
  <h1>hello world!</h1>
</body>
</html>

I think the answer is no, but I want to make sure :)




                                                                              
                                                                              
                                                                               
                                                                            

                
                                                                 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: default values for elements

Posted by Neil Delima <nd...@ca.ibm.com>.



When the feature
http://apache.org/xml/features/validation/schema/element-default is
enabled, the default value of the element is reported via the characters()
callback.  Add an empty element "b" to get this value.


Eric Fedok <er...@synchronoss.com> wrote on 06/10/2004 10:36:09 AM:

> If I have an xsd of:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
>     <xs:element name="a">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="b" minOccurs="0" default="thisisb"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
>
> and an xml file of:
> <?xml version="1.0" encoding="UTF-8"?>
> <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:noNamespaceSchemaLocation="file:/pathto/a.xsd">
> </a>
>
> and I am parsing the document using the SAX parser with features of:
> http://xml.org/sax/features/validation
> http://apache.org/xml/features/validation/schema
> http://xml.org/sax/features/namespaces
> http://apache.org/xml/features/validation/schema/element-default
>
> I would expect the parser to "find" an element b with a value of
> thisisb, however, I do not seem to get any reference to element b in the
> startElement or characters methods of my handler.  Is this a bug or am I
> misunderstanding the purpose of
> http://apache.org/xml/features/validation/schema/element-default?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org