Trouble Using Netbeans and XML Schema

I am currently experimenting on using XML files to store data for a game that I am developing. I had been using NetBeans 5.5 to validate my XML Schema (I am still new to XSD); however, now I am getting errors and have been trying for the better part of the week but am still unable to resolve them. Here is a clip from one of the schemas:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:cdt="http://JoaL.blissfulTragedy.com/Characters"
           targetNamespace="http://JoaL.blissfulTragedy.com/Characters" >
    <!-- Document to Define Character Attributes and their current Constraints -->
    <!-- Character Name -->
    <xs:simpleType name="name">
        <xs:restriction base="xs:NMTOKEN">
            <xs:maxLength value="15"    />
            </xs:restriction>
        </xs:simpleType>
... When I validate the XML (the two down arrows) I get the following errors for every restriction I have declared:
s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot resolve 'xs:NMTOKEN' as a QName: the prefix 'xs' is not declared.After retyping the file three times I tried one of the stock NetBeans schemas, which will produce the same error whenever I add a restriction through the UI.
Any advice will be greatly appreciated :P

I think this is a dirty great bug in the Sun version of the apache Xerces classes that were bundled with jdk1.5.
I've had similar problems, and it seems to boil down to the fact that the NamespaceSupport class's getURI method does == instead of .equals when looking up the uri for a particular prefix. I'm told that this is a deliberate feature for the Apache stuff, and that the class assumes interned strings or strings that have gone through their internal SymbolTable mechanism, and that I can work around it by using interned strings. However, it is one of their classes that fails to intern the string (or put it through the symbol table etc.), so that doesn't really make sense as there are no hooks into this stuff.
They have even marked the bug as closed/fixed, and I'm attempting to re-raise it at present (so it'll be fixed in about ten years then).

Similar Messages

  • Query resultset to xml using java and XML schema

    Hi,
    I query data using JDBC and I want to store it to an XML file which has a well defined XML schema. I searched a lot in the forum but did not find an answer. Please guide me to create this program.
    I have managed to use JDBC to get result set but I do not know how to export is to XML using XSD and Java.
    Please help.
    Regards,
    Ravi

    I have managed to use JDBC to get result set but I do
    not know how to export is to XML using XSD and Java.Export using XSD? Schemas are for validation.
    Iterate through the result set, and build up the XML stream by creating an entry for each row.
    Another way to do it is to load the ResultSet into a Java object and serialize that to XML using something like XStream.
    %

  • Using NetBeans and Eclipse to drag and drop forms, controls etc

    Hi, can you use NetBeans and Eclipse to drag and drop like say with C# in MS Visual Studio ?
    like forms and listboxes, textboxes etc ??

    And [this is a good place to start|http://java.sun.com/docs/books/tutorial/uiswing/index.html]
    db

  • Port and XML Schema

    I wanted to configure the Port and XML schema for a repository.
    I followed the following steps.
    I have XML Schema file in my local disk. Then I created Port in the console.
    However I am not able to see any folder structure getting created on unix server. The port was saved successfuly.
    I can not see the Ready folder for this particular folder.
    Can you please help me?

    Hi SudhaViz,
    Firstly create a remote system and associate that with the port.
    You can find the port in the following path of that particular remote system.
    C:\Program Files\SAP MDM 7.1\Server\Distributions\HostName_DB\Repository Name\Inbound\Remote_System\Port\Ready,
    C being the drive where you have installed MDM Server
    Thank you,
    Minaz

  • Anyone use Netbeans and know where I can find an online tutorial

    hi, just started to learn java and currently using netbeans and want to know where I can find any online tutorials or any links you may know. Thanks =)

    hi, just started to learn java and currently using
    netbeans and want to know where I can find any online
    tutorials or any links you may know. Thanks =)I assume you mean a tutorial for NetBeans, not one for Java. And I assume you know how to use a search engine like www.google.com and didn't find anything, so you asked here. If the assumptions are correct, then I guess there isn't any.

  • Sax and xml schema

    Quick question
    Can you use SAX with XML Schema? or SAX will only work on DTD?
    Thanks!

    sax can use either
    i believe all that is needed is calling
    setNamespaceAware(true) on the parser factory to use xsds (along with setValidating(true))

  • Creating WSDL file using Netbeans and JAX-WS

    I have created a web service called calculator in Netbeans IDE.
    I build the project and deployed in Tomcat.
    When I accessed WSDL file i getting as follows
    *<?xml version="1.0" encoding="UTF-8" ?>*
    - <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://actions.calculator.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://actions.calculator.com/" name="calculatorService">
    - <types>
    - <xsd:schema>
    *<xsd:import schemaLocation="http://localhost:8080/calculator/calculator?xsd=1" namespace="http://actions.calculator.com/" />*
    *</xsd:schema>*
    *</types>*
    etc.......
    here schema is imported from another file...
    I need schema to included in the WSDL file itself.
    How can i get a WSDL file like this??
    I am using Netbeans 5.5 and JAX-WS 2.0

    Hi,
    Change the <soap:binding style="document"... to <soap:binding style="rpc"... and see if that works.
    I'm not sure how to get <soap:binding style="document"... working yet - I'm not that experienced in web services yet.
    Hope this helps and is not too late.
    Regards,
    Greg Nye

  • Webservices and xml schema valdiation

    Hi everyone,
    I have a method call thru web services, where the xml document comes as a string. I need to validate the xml document using xml schema. I have searched the xerces and dom4j apis, but couldn't find anything which allows me to validate an xml document, coming as a document, or as a string (not the location to the file system).
    can anyone help with any resource site, or any code , thats going to be of great help.
    thanx

    DOMParser parser = new DOMParser();
    parser.setFeature("http://xml.org/sax/features/validation", true);
    parser.setProperty(
              "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
              "test.xsd");
    hope this helps.

  • Validation with jaxp 1.3 and xml-schema

    I'm totally green when it comes to xml&jaxp. Using jse 1.5 (jaxp 1.3), I'm trying
    to have my app parse and validate an xml doc with xml schema. I want the validation to
    happen using the schema specified in the xml doc. Also, I'd prefer if my application didn't have to set
    the schema to use. As far as I can make out though, it appears that I need to parse the schemaLocation when
    I want to validate using xml schema. Anyone know a way to avoid that step?
    If not, then any idea why I'm getting the following err?
    Error...
    junit.framework.AssertionFailedError: null/null:4,9: Document is invalid: no grammar found.null/null:4,9: Document root element "catalog", must match DOCTYPE root "null".
         at junit.framework.Assert.fail(Assert.java:47)
         at com.rwd.toolbox.junit.AbstractRwdTestCase.printAndFail(AbstractRwdTestCase.java:229)
         at com.rwd.util.xml.XmlUtilsTests.testXmlValidationUsingSchemaDefinedInXmlDoc(XmlUtilsTests.java:57)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Code... obviously taken from junit test case...
         DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
         documentFactory.setNamespaceAware(true);
         documentFactory.setValidating(true);
         DocumentBuilder builder = documentFactory.newDocumentBuilder();
         com.rwd.util.xml.Validator v = new com.rwd.util.xml.Validator(_validationStyle);
         builder.setErrorHandler(v);
         Document document = builder.parse(_document);
         where com.rwd.util.xml.Validator extends DefaultHandler. Note that if I add following
         code, then validation works as i expect it... but that's not really an option I care for (at least in this case).
         I would anticipate being able to have the parser see the XSD reference in the XML and
         apply it. Anyway, here's code to programmatically specify an XSD to use for validation....                    
         documentFactory.setAttribute(
         "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
         "http://www.w3.org/2001/XMLSchema");
         documentFactory.setAttribute(
         "http://java.sun.com/xml/jaxp/properties/schemaSource",
         "file:///C:/workspace31m4/LMSTester/testData/util/xml/o.xsd");
    Finally, the XML file... (example from onJava site)... Note that I've tried changing the URI to file:///c:/..., same result:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--A OnJava Journal Catalog-->
    <catalog
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="file://C:/workspace31m4/LMSTester/testData/util/xml/o.xsd"
    title="OnJava.com" publisher="O'Reilly">
    <journal date="April 2004">
    <article>
    <title>Declarative Programming in Java</title>
    <author>Narayanan Jayaratchagan</author>
    </article>
    </journal>
    <journal date="January 2004">
    <article>
    <title>Data Binding with XMLBeans</title>
    <author>Daniel Steinberg</author>
    </article>
    </journal>
    </catalog>
    and its XSD file (also from onJava)...
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="catalog">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="journal" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="title" type="xs:string"/>
    <xs:attribute name="publisher" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="journal">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="article" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="date" type="xs:string"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="article">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="title" type="xs:string"/>
    <xs:element ref="author" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="author" type="xs:string"/>
    </xs:schema>
    Thanks,
    -Paul

    There are other applications using Xerces1.0 so the requirement is that I cannot replace the Xerces jar. Any suggestions.

  • OLEDB Dataconnection and XML Schema

    Hi,
    I create a form with fields binding with a OLEDB dataconnection.
    It's work, I can request my database and store my data.
    I want to be able to can access these field in a process (with workbench ES).
    If I bind fields with a xml schema I can access to them and manipulate them but I can't bind them with a OLEDB dataconnection and a xml schema.
    How can I do this ?
    Thank you and I hope you could understand me :D

    Yes, I have a DB but I am already working with the XML file. The Data Connection that I am using has this config:<br /><br />XML Schema<br />Schema file: contents.xsd<br />Options: <contents>, no checkboxes activated<br /><br />My solution is supposed to run online in a LAMP env, when the user clicks a Print Button, I run a script to generate the XML from the DB, and then I open a new page with the PDF form that I've built in LC Designer (8.0) with the generated data. I don't need data navigation, it's a summary report that will be printed.<br /><br />So, while developing, I've saved a populated XML locally and keep trying to open the PDF file with the data without success. Same if I save the 3 files (xsd, xml and pdf form) in the server and try to open the PDF through browser. But, as I said before, when previewing it in LC, I see the form exactly as I want.<br />I did what you mentioned (import data in Adobe Reader), and it worked partially, since the repeating row just showed one record.<br /><br />As I can see, I need some kind of script in the PDF form that, when it's loaded, the data (XML file) is imported. By now, I am trying to do it locally and think this should work. Then, for the online solution, I thought that I would need something running on the server, and based on what you said, I will need LC Forms, is that correct?<br /><br />Hope things are clearer now. Answering to your question, my form is binded globally. The repeating row is connected (Default Binding) to > $record.content[*] < and each field in the row connected to an item from the XSD definition. No Import/Export Bindings in use.<br /><br />Thanks for the help so far! :)

  • InputVerifier and XML Schema

    Is there a way by which I can pass the contstraints for a TextField to the InputVerifier, after getting them from the XML Schema. For example if I have a schema like:-
    ***************************** Start *****************************
    <?xml version="1.0" encoding="GB2312"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="OperationMessage">
    <xs:complexType>
    <xs:sequence>
    <!-- Version cannot be greater than 10 characters-->
    <xs:element name="Version">
    <xs:complexType>
    <xs:attribute name="versionId" use="required">
    <xs:simpleType>
         <xs:restriction base="xs:float">
         <xs:pattern value="[0-9]\.[0-9][0-9]"/>
         </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    </xs:element>
    <xs:element name="Subsystem">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Message" minOccurs="0" maxOccurs="unbounded">
         <xs:complexType>
         <xs:sequence>
         <xs:element name="Content" minOccurs="2" maxOccurs="2">
    <xs:complexType>
         <xs:simpleContent>
         <xs:extension base="xs:token">
         <xs:attribute name="langId" use="required">
         <xs:simpleType>
              <xs:restriction base="xs:NMTOKEN">
              <xs:enumeration value="en"/>
              <xs:enumeration value="zh"/>
              </xs:restriction>
         </xs:simpleType>
         </xs:attribute>
    </xs:extension>                              </xs:simpleContent>
         </xs:complexType>
    </xs:element>          
         </xs:sequence>                                   <xs:attribute name="Code" use="required">
         <xs:simpleType>
         <xs:restriction base="xs:positiveInteger">
         <xs:pattern value="[0-9][0-9][0-9][0-9][0-9][0-9]"/>
         </xs:restriction>
         </xs:simpleType>
         </xs:attribute>                                   </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="ssId" use="required">
    <xs:simpleType>
         <xs:restriction base="xs:token">
         <xs:minLength value="1"/>
         <xs:maxLength value="8"/>
         </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    <xs:key name="messageCode">
    <xs:selector xpath="Message"/>
    <xs:field xpath="@Code"/>
    </xs:key>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    ************************ Schema End ***************************
    And i have a form which is based on this schema. Now, is it possible to
    get the constraints from the schema and apply them to the textfiels or other input components. Infact things will become easy if there is a way to get hold of the constraints from the schema.
    Thanx in advance,
    Regards,
    Debopam.

    Infact if there is a way to get hold of the Schema constraints, then they could be show as ToolTips to the user, which will help them in filling up the form.

  • XDK and XML Schema

    Hello All!
    I am using standalone Oracle XDK for C 9.2.0.2.0 on Windows NT 4.0. The fragment of my XML schema is shown below:
    <xsd:simpleType name="Text30">
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="30"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="CCode">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="\d{5}|\d{8}|\d{12}"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:complexType name="ReferenceNo">
    <xsd:simpleContent>
    <xsd:extension base="Text30">
    <xsd:attribute name="cCode" type="CCode" use="required"/>
    <xsd:attribute name="docDate" type="xsd:date" use="required"/>
    <xsd:attribute name="TIRPageNo" type="TIRGreenPageNo" use="optional"/>
    <xsd:attributeGroup ref="DeclarType"/>
    </xsd:extension>
    </xsd:simpleContent>
    </xsd:complexType>
    And the part of the instance document looks like:
    <DocNo cCode="10501000 ... />, where "DocNo" is of type "ReferenceNo".
    Then validating my XML document I am always getting error that my "cCode" attribute doesn't match
    pattern. After removing <xsd:pattern value="\d{5}|\d{8}|\d{12}"/> from schema all seems to be OK.
    Why? Where is the error? "\d{5}|\d{8}|\d{12}" is a valid regexp according the W3C XML Schema specification.
    Any help will be appreciated. Thanks.
    Egor Pervouninski
    [email protected]

    Hello All!
    I have localized the problem. Seems to be a bug in XDK for C/C++ 9_2_0_2_0 (and for Java too)!
    Create three files:
    --- error.xsd ---
    <?xml version="1.0" encoding="Windows-1251"?>
    <xsd:schema targetNamespace="urn:xdk:error" xmlns="urn:xdk:error" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xsd:simpleType name="Code">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="\d{1}|\d{2}|\d{3}"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:complexType name="Root">
    <xsd:attribute name="code" type="Code"/>
    </xsd:complexType>
    <xsd:element name="root" type="Root"/>
    </xsd:schema>
    --- error.xsd ---
    -- error1.xml ---
    <?xml version="1.0" encoding="Windows-1251"?>
    <root xmlns="urn:xdk:error" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:xdk:error
    error.xsd" code="1"/>
    --- error1.xml ---
    --- error2.xml ---
    <?xml version="1.0" encoding="Windows-1251"?>
    <root xmlns="urn:xdk:error" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:xdk:error
    error.xsd" code="12"/>
    --- error2.xml ---
    Execute: schema.exe error1.xml error.xsd (Java: oraxml.bat -schema error1.xml)
    All OK!
    Execute: schema.exe error2.xml error.xsd (Java: oraxml.bat -schema error2.xml)
    In line 3 of error2.xml:
    LSX-00333: literal "12" is not valid with respect to the pattern
    I have tested the same examples with XML Spy 4.4, MSXML 4.0 and Xerces-C 1.7.0.
    All parsers have validated this examples without any errors... except XDK.
    Egor Pervouninski
    [email protected]

  • Regular Expressions and XML Schemas

    The standard regular expression syntax in JDK1.4 doesn't support some of the constructs used by pattern facets in XML schemas.
    For example the "Name" type is specified by the pattern "\i\c*" but the java.util.regex regular expression handler throws an exception when it encounters this with the following message:
    Illegal/unsupported escape squence near index 1
    Is anyone aware of any regular expression java libraries or tools that will cope with the XML syntax?

    Thanks, but perhaps I should clarify. I realise that \i\c* is invalid syntax in the java regexp handler. My point is that in XML Schema regular expressions \i is meaningful - in fact it means
    "the set of initial name characters, those matched by Letter | '_' | ':' "
    I was wondering if anyone knew of a regular expression library that understood and correctly interpreted that.

  • SQL and XML Schema

    I hope this is the right forum to post. I was wondering if there are any good tutorials or books on SQL to XML?
    Basically I need to query accounts in the state of North Carolina that have recieved a certain document in the past day. That is a very easy task to do in SQL however the state of NC wants us to report our findings in a specific XML schema using nodes.
    Luckily I have the schema which was given by the state of NC however not sure how to get my query to fit into the XML schema. Just wondering from a beginners perspective.
    Sorry for the newbie questions.

    The [XML DB Forum|http://forums.oracle.com/forums/thread.jspa?threadID=410714&tstart=0] is a good place to start.

  • Jax-ws and xml schema

    hello,
    i'm developping a web service that returns an object person(String name, int age) as result, when generating my wsdl using jax-ws I've found that just the name of the xml schema representing my object person is present (relatif path), so i want either to generate the absolute path in my wsdl or to incorporate the xsd in it.
    thanks.

    chutchai.chailuecha wrote:
    Are there any part in JAX-WS, JSR181, JSR109 specification or any document state something about how a Java EE container should discover the webservices annotation? Hi,
    i only know about JSR181 (chapter "processor responsibilities" or something...)
    maybe on https://glassfish.dev.java.net/ people will tell you, how they are processed on glassfish server.
    Regards

Maybe you are looking for